Skip to content

Fix type reference to merged prototype property assignment #34764

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

Conversation

sandersn
Copy link
Member

@sandersn sandersn commented Oct 28, 2019

The constructor function code path in the return type checking of signatures needs to pass the merged symbol of the declaration to getDeclaredTypeOfClassOrInterface. Other callers of getDeclaredTypeOfClassOrInterface do this, or used an already-merged symbol.

Fixes #33993

For background, this call is new in the code path -- before 3.7, constructor functions were not classes and fell through to getReturnTypeOfSignature, where they would retrieve the type put there earlier by ad-hoc code. getDeclaredTypeOfClassOrInterface invokes the full class creation machinery but asserts that the symbol is correctly marked with the Class flag. If it's not, fails in a number of places. (The assertion postdates the filing of the bug.)

The constructor function code path in the return type checking of
signatures needs to pass the *merged* symbol of the declaration to
getDeclaredTypeOfClassOrInterface. Other callers of
getDeclaredTypeOfClassOrInterface do this, or used an already-merged
symbol.

Fixes #33993
@sandersn sandersn merged commit 080e41d into master Oct 28, 2019
@sandersn sandersn deleted the fix-type-reference-to-merged-prototype-property-assignment branch October 28, 2019 17:14
@sandersn
Copy link
Member Author

@typescript-bot cherry-pick this to release-3.7

@typescript-bot
Copy link
Collaborator

Hey @sandersn, I've opened #34765 for you.

typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Oct 28, 2019
Component commits:
ab9bc3a Fix type reference to merged prototype property assignment
The constructor function code path in the return type checking of
signatures needs to pass the *merged* symbol of the declaration to
getDeclaredTypeOfClassOrInterface. Other callers of
getDeclaredTypeOfClassOrInterface do this, or used an already-merged
symbol.

Fixes microsoft#33993
sandersn pushed a commit that referenced this pull request Oct 28, 2019
Component commits:
ab9bc3a Fix type reference to merged prototype property assignment
The constructor function code path in the return type checking of
signatures needs to pass the *merged* symbol of the declaration to
getDeclaredTypeOfClassOrInterface. Other callers of
getDeclaredTypeOfClassOrInterface do this, or used an already-merged
symbol.

Fixes #33993
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allowJs + declaration: Cannot read property 'parent' of undefined
3 participants