Fix crash when circular reference in variance annotations (#48539)

* Fix crash when circular reference in variance annotations

* chore: clean code
This commit is contained in:
magic-akari
2022-04-04 23:33:47 +08:00
committed by GitHub
parent 2db17fdda2
commit 99620117be
6 changed files with 55 additions and 0 deletions

View File

@@ -20640,6 +20640,9 @@ namespace ts {
function createMarkerType(symbol: Symbol, source: TypeParameter, target: Type) {
const mapper = makeUnaryTypeMapper(source, target);
const type = getDeclaredTypeOfSymbol(symbol);
if (isErrorType(type)) {
return type;
}
const result = symbol.flags & SymbolFlags.TypeAlias ?
getTypeAliasInstantiation(symbol, instantiateTypes(getSymbolLinks(symbol).typeParameters!, mapper)) :
createTypeReference(type as GenericType, instantiateTypes((type as GenericType).typeParameters, mapper));