Skip to content

isMethodLike recognises prototype-assignment methods#22935

Merged
sandersn merged 2 commits into
masterfrom
isMethodLike-recognises-js-prototype-methods
Mar 28, 2018
Merged

isMethodLike recognises prototype-assignment methods#22935
sandersn merged 2 commits into
masterfrom
isMethodLike-recognises-js-prototype-methods

Conversation

@sandersn
Copy link
Copy Markdown
Member

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

Fixes #22895

Comment thread src/compiler/checker.ts Outdated

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
Copy Markdown
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
Copy Markdown
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