Skip to content

Commit 3f77e1e

Browse files
author
Andy
authored
Support import completion for merged declaration exports (#24539) (#24572)
1 parent 8dc7d5a commit 3f77e1e

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/services/completions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ namespace ts.Completions {
628628
}
629629

630630
const { moduleSymbol } = symbolOriginInfo;
631-
const exportedSymbol = skipAlias(symbol.exportSymbol || symbol, checker);
631+
const exportedSymbol = checker.getMergedSymbol(skipAlias(symbol.exportSymbol || symbol, checker));
632632
const { moduleSpecifier, codeAction } = codefix.getImportCompletionAction(
633633
exportedSymbol,
634634
moduleSymbol,
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/// <reference path="fourslash.ts" />
2+
3+
// @module: esnext
4+
5+
// @Filename: /a.ts
6+
////declare module "m" {
7+
//// export default class M {}
8+
////}
9+
10+
// @Filename: /b.ts
11+
////declare module "m" {
12+
//// export default interface M {}
13+
////}
14+
15+
// @Filename: /c.ts
16+
/////**/
17+
18+
goTo.marker("");
19+
verify.completionListContains({ name: "M", source: "m" }, "class M", "", "class", /*spanIndex*/ undefined, /*hasAction*/ true, {
20+
includeCompletionsForModuleExports: true,
21+
sourceDisplay: "m",
22+
});
23+
24+
verify.applyCodeActionFromCompletion("", {
25+
name: "M",
26+
source: "m",
27+
description: `Import 'M' from module "m"`,
28+
newFileContent: `import M from "m";
29+
30+
`,
31+
});

0 commit comments

Comments
 (0)