Fix crash caused by cyclic defaults (#30532)

This commit is contained in:
Wesley Wigham
2019-03-21 18:27:14 -07:00
committed by GitHub
parent e72f006664
commit b86dea03f2
6 changed files with 78 additions and 4 deletions

View File

@@ -5474,9 +5474,6 @@ namespace ts {
}
return type;
}
if (declaration.kind === SyntaxKind.ExportAssignment) {
return widenTypeForVariableLikeDeclaration(checkExpressionCached((<ExportAssignment>declaration).expression), declaration);
}
// Handle variable, parameter or property
if (!pushTypeResolution(symbol, TypeSystemPropertyName.Type)) {
@@ -5487,7 +5484,10 @@ namespace ts {
return reportCircularityError(symbol);
}
let type: Type | undefined;
if (isInJSFile(declaration) &&
if (declaration.kind === SyntaxKind.ExportAssignment) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached((<ExportAssignment>declaration).expression), declaration);
}
else if (isInJSFile(declaration) &&
(isCallExpression(declaration) || isBinaryExpression(declaration) || isPropertyAccessExpression(declaration) && isBinaryExpression(declaration.parent))) {
type = getWidenedTypeFromAssignmentDeclaration(symbol);
}