Skip to content

isMethodLike recognises prototype-assignment methods #22935

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 2 commits into from
Mar 28, 2018

Conversation

sandersn
Copy link
Member

Previously it did not. This led to some bogus errors.

Fixes #22895

@@ -16103,7 +16103,7 @@ namespace ts {
}

function isMethodLike(symbol: Symbol) {
return !!(symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod);
return !!(symbol.flags & SymbolFlags.Method || getCheckFlags(symbol) & CheckFlags.SyntheticMethod || isFunctionLikeDeclaration(getAssignedJavascriptInitializer(symbol.valueDeclaration)));
Copy link
Contributor

Choose a reason for hiding this comment

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

should we condition this on isInJavaScriptFile(symbol.valueDeclaration) as well

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch. I forgot that get*JavascriptInitializer doesn't check whether the node is actually in a js file.

@sandersn sandersn merged commit adf30dd into master Mar 28, 2018
@sandersn sandersn deleted the isMethodLike-recognises-js-prototype-methods branch March 28, 2018 17:41
@microsoft microsoft locked and limited conversation to collaborators Jul 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants