Skip to content
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

Check for undefined source.symbol when elaborating unmatched properties #37021

Merged
merged 1 commit into from
Feb 25, 2020

Conversation

RyanCavanaugh
Copy link
Member

Fixes #37014

@RyanCavanaugh
Copy link
Member Author

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Feb 25, 2020

Heya @RyanCavanaugh, I've started to run the task to cherry-pick this into release-3.8 on this PR at 864c2d4. You can monitor the build here.

@RyanCavanaugh RyanCavanaugh merged commit 43863ca into microsoft:master Feb 25, 2020
@RyanCavanaugh RyanCavanaugh deleted the fix37014 branch February 25, 2020 21:46
typescript-bot pushed a commit to typescript-bot/TypeScript that referenced this pull request Feb 25, 2020
Component commits:
864c2d4 Check for undefined `source.symbol`
Fixes microsoft#37014
@typescript-bot
Copy link
Collaborator

Hey @RyanCavanaugh, I've opened #37025 for you.

RyanCavanaugh added a commit that referenced this pull request Feb 25, 2020
Component commits:
864c2d4 Check for undefined `source.symbol`
Fixes #37014

Co-authored-by: Ryan Cavanaugh <RyanCavanaugh@users.noreply.github.com>
@@ -16239,6 +16239,7 @@ namespace ts {
if (unmatchedProperty.valueDeclaration
&& isNamedDeclaration(unmatchedProperty.valueDeclaration)
&& isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
&& source.symbol
Copy link
Contributor

Choose a reason for hiding this comment

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

source uses the type Type. Based on the Type definition property symbol cannot be undefined.

symbol: Symbol; // Symbol associated with type (if any)

Are there are other cases when symbol can be undefined? Maybe make sense to change type definition from symbol: Symbol; to symbol: Symbol | undefined in order to avoid such bugs?

What do you @DanielRosenwasser @RyanCavanaugh @weswigham think?

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

Successfully merging this pull request may close these issues.

Can't affect unknown to class with private field: Cannot read property 'flags' of undefined
5 participants