Fixed an accidental undefined leak into getAccessibleSymbolChain's cache key (#58669)

This commit is contained in:
Mateusz Burzyński 2024-10-31 23:18:27 +01:00 committed by GitHub
parent e4dc78ab8c
commit 32513a7745
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}