mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Fix issue with narrowing exported variables
This commit is contained in:
1 parent
0a25bb58a4
commit
187eaaee7f
1 file changed
+3
-4
@@ -7165,12 +7165,11 @@ namespace ts {
|
||||
if (!leftmostIdentifier) {
|
||||
return type;
|
||||
}
|
||||
const leftmostSymbol = getResolvedSymbol(leftmostIdentifier);
|
||||
if (!(leftmostSymbol.flags & SymbolFlags.Variable)) {
|
||||
const declaration = getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(leftmostIdentifier)).valueDeclaration;
|
||||
if (!declaration || declaration.kind !== SyntaxKind.VariableDeclaration && declaration.kind !== SyntaxKind.Parameter && declaration.kind !== SyntaxKind.BindingElement) {
|
||||
return type;
|
||||
}
|
||||
const declaration = getDeclarationOfKind(leftmostSymbol, SyntaxKind.VariableDeclaration);
|
||||
const top = declaration && getDeclarationContainer(declaration);
|
||||
const top = getDeclarationContainer(declaration);
|
||||
const originalType = type;
|
||||
const nodeStack: { node: Node, child: Node }[] = [];
|
||||
let node: Node = reference;
|
||||
|
||||
Reference in new issue
Block a user