From 32513a7745b606dc8b33c8a4c722aaa026752283 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Thu, 31 Oct 2024 23:18:27 +0100 Subject: [PATCH] Fixed an accidental `undefined` leak into `getAccessibleSymbolChain`'s cache key (#58669) --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index ea5971b3f7b..ce0291367b5 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5566,7 +5566,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker { const cache = (links.accessibleChainCache ||= new Map()); // Go from enclosingDeclaration to the first scope we check, so the cache is keyed off the scope and thus shared more const firstRelevantLocation = forEachSymbolTableInScope(enclosingDeclaration, (_, __, ___, node) => node); - const key = `${useOnlyExternalAliasing ? 0 : 1}|${firstRelevantLocation && getNodeId(firstRelevantLocation)}|${meaning}`; + const key = `${useOnlyExternalAliasing ? 0 : 1}|${firstRelevantLocation ? getNodeId(firstRelevantLocation) : 0}|${meaning}`; if (cache.has(key)) { return cache.get(key); }