mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 16:38:05 -06:00
Never overwrite resolved type of symbol
This commit is contained in:
parent
b2b360a64f
commit
059fd2d42e
@ -5425,7 +5425,16 @@ namespace ts {
|
||||
|
||||
function getTypeOfVariableOrParameterOrProperty(symbol: Symbol): Type {
|
||||
const links = getSymbolLinks(symbol);
|
||||
return links.type || (links.type = getTypeOfVariableOrParameterOrPropertyWorker(symbol));
|
||||
if (!links.type) {
|
||||
const type = getTypeOfVariableOrParameterOrPropertyWorker(symbol);
|
||||
// For a contextually typed parameter it is possible that a type has already
|
||||
// been assigned (in assignTypeToParameterAndFixTypeParameters), and we want
|
||||
// to preserve this type.
|
||||
if (!links.type) {
|
||||
links.type = type;
|
||||
}
|
||||
}
|
||||
return links.type;
|
||||
}
|
||||
|
||||
function getTypeOfVariableOrParameterOrPropertyWorker(symbol: Symbol) {
|
||||
@ -5469,7 +5478,7 @@ namespace ts {
|
||||
if (symbol.flags & SymbolFlags.ValueModule) {
|
||||
return getTypeOfFuncClassEnumModule(symbol);
|
||||
}
|
||||
return errorType;
|
||||
return reportCircularityError(symbol);
|
||||
}
|
||||
let type: Type | undefined;
|
||||
if (isInJSFile(declaration) &&
|
||||
@ -5528,7 +5537,7 @@ namespace ts {
|
||||
if (symbol.flags & SymbolFlags.ValueModule) {
|
||||
return getTypeOfFuncClassEnumModule(symbol);
|
||||
}
|
||||
type = reportCircularityError(symbol);
|
||||
return reportCircularityError(symbol);
|
||||
}
|
||||
return type;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user