mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Fix crash in recursive declared type resolution (#23950)
When one type has a type parameter with a default
This commit is contained in:
committed by
GitHub
parent
b31968a598
commit
e27fb0651b
@@ -5656,6 +5656,10 @@ namespace ts {
|
||||
const symbol = type.symbol;
|
||||
const members = getMembersOfSymbol(symbol);
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredProperties = getNamedMembers(members);
|
||||
// Start with signatures at empty array in case of recursive types
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = emptyArray;
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = emptyArray;
|
||||
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredCallSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.Call));
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredConstructSignatures = getSignaturesOfSymbol(members.get(InternalSymbolName.New));
|
||||
(<InterfaceTypeWithDeclaredMembers>type).declaredStringIndexInfo = getIndexInfoOfSymbol(symbol, IndexKind.String);
|
||||
@@ -7048,7 +7052,7 @@ namespace ts {
|
||||
for (let i = numTypeArguments; i < numTypeParameters; i++) {
|
||||
const mapper = createTypeMapper(typeParameters, typeArguments);
|
||||
let defaultType = getDefaultFromTypeParameter(typeParameters[i]);
|
||||
if (defaultType && isTypeIdenticalTo(defaultType, emptyObjectType) && isJavaScriptImplicitAny) {
|
||||
if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
|
||||
defaultType = anyType;
|
||||
}
|
||||
typeArguments[i] = defaultType ? instantiateType(defaultType, mapper) : getDefaultTypeArgumentType(isJavaScriptImplicitAny);
|
||||
|
||||
Reference in New Issue
Block a user