mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
fix(51202): Circular instantiation expression crashing IDEs (#51214)
This commit is contained in:
@@ -6677,6 +6677,20 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
}
|
||||
else {
|
||||
const isInstantiationExpressionType = !!(getObjectFlags(type) & ObjectFlags.InstantiationExpressionType);
|
||||
if (isInstantiationExpressionType) {
|
||||
const instantiationExpressionType = type as InstantiationExpressionType;
|
||||
if (isTypeQueryNode(instantiationExpressionType.node)) {
|
||||
const typeNode = serializeExistingTypeNode(context, instantiationExpressionType.node);
|
||||
if (typeNode) {
|
||||
return typeNode;
|
||||
}
|
||||
}
|
||||
if (context.visitedTypes?.has(typeId)) {
|
||||
return createElidedInformationPlaceholder(context);
|
||||
}
|
||||
return visitAndTransformType(type, createTypeNodeFromObjectType);
|
||||
}
|
||||
// Anonymous types without a symbol are never circular.
|
||||
return createTypeNodeFromObjectType(type);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user