Skip to content

Commit

Permalink
Check for undefined source.symbol
Browse files Browse the repository at this point in the history
Fixes #37014
  • Loading branch information
RyanCavanaugh committed Feb 25, 2020
1 parent 26184f0 commit d8ce7d7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16239,6 +16239,7 @@ namespace ts {
if (unmatchedProperty.valueDeclaration
&& isNamedDeclaration(unmatchedProperty.valueDeclaration)
&& isPrivateIdentifier(unmatchedProperty.valueDeclaration.name)
&& source.symbol
&& source.symbol.flags & SymbolFlags.Class) {
const privateIdentifierDescription = unmatchedProperty.valueDeclaration.name.escapedText;
const symbolTableKey = getSymbolNameForPrivateIdentifier(source.symbol, privateIdentifierDescription);
Expand Down
5 changes: 5 additions & 0 deletions tests/cases/compiler/privateFieldAssignabilityFromUnknown.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export class Class {
#field: any
}

const task: Class = {} as unknown;

0 comments on commit d8ce7d7

Please sign in to comment.