-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fixed reported errors for variadic element mismatches #58708
Conversation
There was a problem hiding this 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
src/compiler/checker.ts
Outdated
@@ -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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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 😉
Looks like this one needs a small resync with |
I synced this with main, it should now be ready to merge :) |
fixes #58697