diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 3cd54756236..1b38ca72a46 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -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 diff --git a/tests/cases/fourslash/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol.ts b/tests/cases/fourslash/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol.ts new file mode 100644 index 00000000000..0e24ff734b2 --- /dev/null +++ b/tests/cases/fourslash/quickInfoOnValueSymbolWithoutExportWithSameNameExportSymbol.ts @@ -0,0 +1,22 @@ +/// +// @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");