Skip to content

Commit 269867f

Browse files
author
Andy
authored
Fix bug: get merged symbol of symbol.parent before checking against module symbol (#21147)
1 parent e3da8fb commit 269867f

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1200,7 +1200,7 @@ namespace ts.Completions {
12001200
// Don't add a completion for a re-export, only for the original.
12011201
// If `symbol.parent !== ...`, this comes from an `export * from "foo"` re-export. Those don't create new symbols.
12021202
// If `some(...)`, this comes from an `export { foo } from "foo"` re-export, which creates a new symbol (thus isn't caught by the first check).
1203-
if (symbol.parent !== typeChecker.resolveExternalModuleSymbol(moduleSymbol)
1203+
if (typeChecker.getMergedSymbol(symbol.parent) !== typeChecker.resolveExternalModuleSymbol(moduleSymbol)
12041204
|| some(symbol.declarations, d => isExportSpecifier(d) && !!d.parent.parent.moduleSpecifier)) {
12051205
continue;
12061206
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @Filename: /b.d.ts
4+
////declare namespace N {
5+
//// export const foo: number;
6+
////}
7+
////declare module "n" {
8+
//// export = N;
9+
////}
10+
11+
// @Filename: /c.d.ts
12+
////declare namespace N {}
13+
14+
// @Filename: /a.ts
15+
////fo/**/
16+
17+
goTo.marker("");
18+
verify.completionListContains({ name: "foo", source: "n" }, "const N.foo: number", "", "const", undefined, /*hasAction*/ true, {
19+
includeExternalModuleExports: true,
20+
sourceDisplay: "n",
21+
});

0 commit comments

Comments
 (0)