mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-17 12:19:32 -05:00
Fix up code so we don't crash when TS itself is emitted with let/const (#50151)
This commit is contained in:
@@ -27075,9 +27075,11 @@ namespace ts {
|
||||
case AssignmentDeclarationKind.ExportsProperty:
|
||||
case AssignmentDeclarationKind.Prototype:
|
||||
case AssignmentDeclarationKind.PrototypeProperty:
|
||||
let valueDeclaration = binaryExpression.left.symbol?.valueDeclaration;
|
||||
// falls through
|
||||
case AssignmentDeclarationKind.ModuleExports:
|
||||
let valueDeclaration: Declaration | undefined;
|
||||
if (kind !== AssignmentDeclarationKind.ModuleExports) {
|
||||
valueDeclaration = binaryExpression.left.symbol?.valueDeclaration;
|
||||
}
|
||||
valueDeclaration ||= binaryExpression.symbol?.valueDeclaration;
|
||||
const annotated = valueDeclaration && getEffectiveTypeAnnotationNode(valueDeclaration);
|
||||
return annotated ? getTypeFromTypeNode(annotated) : undefined;
|
||||
|
||||
Reference in New Issue
Block a user