Don't widen unique symbols annotated by effective type nodes in JS files (#61180)

This commit is contained in:
Mateusz Burzyński
2025-02-24 20:53:10 +01:00
committed by GitHub
parent 2c3be449ff
commit 7507b055de
6 changed files with 124 additions and 1 deletions

View File

@@ -11821,7 +11821,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
// always widen a 'unique symbol' type if the type was created for a different declaration.
if (type.flags & TypeFlags.UniqueESSymbol && (isBindingElement(declaration) || !declaration.type) && type.symbol !== getSymbolOfDeclaration(declaration)) {
if (type.flags & TypeFlags.UniqueESSymbol && (isBindingElement(declaration) || !tryGetTypeFromEffectiveTypeNode(declaration)) && type.symbol !== getSymbolOfDeclaration(declaration)) {
type = esSymbolType;
}