-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Fix this-type in prototype-assigned object literals #26925
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
Fix this-type in prototype-assigned object literals #26925
Conversation
Some cases were missing from tryGetThisTypeAt. Fixes #26831
.left as PropertyAccessExpression) // x.prototype.y | ||
.expression as PropertyAccessExpression) // x.prototype | ||
.expression; // x | ||
const className = getClassNameFromPrototypeMethod(container); |
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.
Shouldn't this code be gated by isInJavaScriptFile(node)
like a later block at the bottom of tryGetThisTypeAt
?
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.
Yes, and the @constructor
check below as well.
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.
Fixed.
Is there an issue open for the following problem? /** @type {Multimap} */
let m = new Multimap();
m.set("", ""); This doesn't work because |
Here's the issue you found: #26885 It must have to do with type resolution because removing the type annotation makes the error go away. |
Some cases were missing from tryGetThisTypeAt.
Like the previous fix, the baselines still have an error because of a new bug I found: #26923. It's a regression, but it's only in noImplicitAny.
Fixes #26831