mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Cache started nonexistent property error checks to prevent reentrancy in the check (#60683)
This commit is contained in:
@@ -34466,6 +34466,13 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
}
|
||||
|
||||
function reportNonexistentProperty(propNode: Identifier | PrivateIdentifier, containingType: Type, isUncheckedJS: boolean) {
|
||||
const links = getNodeLinks(propNode);
|
||||
const cache = (links.nonExistentPropCheckCache ||= new Set());
|
||||
const key = `${getTypeId(containingType)}|${isUncheckedJS}`;
|
||||
if (cache.has(key)) {
|
||||
return;
|
||||
}
|
||||
cache.add(key);
|
||||
let errorInfo: DiagnosticMessageChain | undefined;
|
||||
let relatedInfo: Diagnostic | undefined;
|
||||
if (!isPrivateIdentifier(propNode) && containingType.flags & TypeFlags.Union && !(containingType.flags & TypeFlags.Primitive)) {
|
||||
|
||||
@@ -6254,6 +6254,7 @@ export interface NodeLinks {
|
||||
potentialUnusedRenamedBindingElementsInTypes?: BindingElement[];
|
||||
externalHelpersModule?: Symbol; // Resolved symbol for the external helpers module
|
||||
instantiationExpressionTypes?: Map<number, Type>; // Cache of instantiation expression types for the node
|
||||
nonExistentPropCheckCache?: Set<string>;
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
|
||||
Reference in New Issue
Block a user