Fixed type lookup on non-exported value symbol when it has an export symbol (#52140)

This commit is contained in:
Mateusz Burzyński
2023-02-01 01:42:29 +01:00
committed by GitHub
parent 42530c3c8d
commit 3d07795092
2 changed files with 23 additions and 1 deletions

View File

@@ -27198,7 +27198,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}
function getTypeOfSymbolAtLocation(symbol: Symbol, location: Node) {
symbol = symbol.exportSymbol || symbol;
symbol = getExportSymbolOfValueSymbolIfExported(symbol);
// If we have an identifier or a property access at the given location, if the location is
// an dotted name expression, and if the location is not an assignment target, obtain the type

View File

@@ -0,0 +1,22 @@
/// <reference path='fourslash.ts' />
// @strict: true
////
//// declare function num(): number
//// const /*1*/Unit = num()
//// export type Unit = number
//// const value = /*2*/Unit
////
//// function Fn() {}
//// export type Fn = () => void
//// /*3*/Fn()
////
//// // repro from #41897
//// const /*4*/X = 1;
//// export interface X {}
verify.quickInfoAt("1", "const Unit: number");
verify.quickInfoAt("2", "const Unit: number");
verify.quickInfoAt("3", "function Fn(): void");
verify.quickInfoAt("4", "const X: 1");