Skip to content

Fixed reported errors for variadic element mismatches #58708

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 14, 2024

Conversation

Andarist
Copy link
Contributor

fixes #58697

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label May 30, 2024
Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems correct to me? @weswigham

@jakebailey jakebailey requested a review from weswigham May 31, 2024 00:32
@@ -23411,7 +23411,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
const sourceArity = getTypeReferenceArity(source);
const targetArity = getTypeReferenceArity(target);
const sourceRestFlag = isTupleType(source) ? source.target.combinedFlags & ElementFlags.Rest : ElementFlags.Rest;
const targetRestFlag = target.target.combinedFlags & ElementFlags.Rest;
const targetHasRestElement = target.target.hasRestElement;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

type.hasRestElement = !!(combinedFlags & ElementFlags.Variable);, and ElementFlags.Variable is ElementFlags.Rest | ElementFlags.Variadic so... yeah, I guess this works to expand the check from just rest to rest and variadic elements! I read this like 3 times before checking how hasRestElement was defined and realizing that, though.

We should slap a @deprecated on hasRestElement, really. The element flags are really the new way to check that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should slap a @deprecated on hasRestElement, really. The element flags are really the new way to check that.

#58864 😉

@weswigham
Copy link
Member

Looks like this one needs a small resync with main before it can be merged, though~

@typescript-bot typescript-bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 14, 2024
@Andarist
Copy link
Contributor Author

I synced this with main, it should now be ready to merge :)

@weswigham weswigham merged commit 61ffce0 into microsoft:main Jun 14, 2024
28 checks passed
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spread of two generic array types is misreported as having length 2
4 participants