File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -5425,7 +5425,16 @@ namespace ts {
5425
5425
5426
5426
function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type {
5427
5427
const links = getSymbolLinks(symbol);
5428
- return links.type || (links.type = getTypeOfVariableOrParameterOrPropertyWorker(symbol));
5428
+ if (!links.type) {
5429
+ const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
5430
+ // For a contextually typed parameter it is possible that a type has already
5431
+ // been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
5432
+ // to preserve this type.
5433
+ if (!links.type) {
5434
+ links.type = type;
5435
+ }
5436
+ }
5437
+ return links.type;
5429
5438
}
5430
5439
5431
5440
function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol) {
@@ -5469,7 +5478,7 @@ namespace ts {
5469
5478
if (symbol.flags & SymbolFlags.ValueModule) {
5470
5479
return getTypeOfFuncClassEnumModule(symbol);
5471
5480
}
5472
- return errorType ;
5481
+ return reportCircularityError(symbol) ;
5473
5482
}
5474
5483
let type: Type | undefined;
5475
5484
if (isInJSFile(declaration) &&
@@ -5528,7 +5537,7 @@ namespace ts {
5528
5537
if (symbol.flags & SymbolFlags.ValueModule) {
5529
5538
return getTypeOfFuncClassEnumModule(symbol);
5530
5539
}
5531
- type = reportCircularityError(symbol);
5540
+ return reportCircularityError(symbol);
5532
5541
}
5533
5542
return type;
5534
5543
}
You can’t perform that action at this time.
0 commit comments