Skip to content

Commit e17d95d

Browse files
authored
When creating synthetic default symbol set parent as module symbol (#41282)
Fixes #40684
1 parent 4d85f03 commit e17d95d

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/compiler/checker.ts

+1
Original file line numberDiff line numberDiff line change
@@ -28499,6 +28499,7 @@ namespace ts {
2849928499
if (hasSyntheticDefault) {
2850028500
const memberTable = createSymbolTable();
2850128501
const newSymbol = createSymbol(SymbolFlags.Alias, InternalSymbolName.Default);
28502+
newSymbol.parent = originalSymbol;
2850228503
newSymbol.nameType = getLiteralType("default");
2850328504
newSymbol.target = resolveSymbol(symbol);
2850428505
memberTable.set(InternalSymbolName.Default, newSymbol);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/// <reference path='fourslash.ts'/>
2+
3+
// @esModuleInterop: true
4+
// @moduleResolution: node
5+
// @target: es2015
6+
// @module: esnext
7+
8+
// @Filename: /node_modules/@bar/foo/index.d.ts
9+
//// export = Foo;
10+
//// declare class Foo {}
11+
//// declare namespace Foo {} // class/namespace declaration causes the issue
12+
13+
// @Filename: /node_modules/foo/index.d.ts
14+
//// import * as Foo from "@bar/foo";
15+
//// export = Foo;
16+
17+
// @Filename: /index.ts
18+
//// import Foo from "foo";
19+
//// /**/
20+
21+
goTo.file("/index.ts");
22+
verify.completions({
23+
marker: "",
24+
includes: ["Foo"],
25+
preferences: {
26+
includeCompletionsForModuleExports: true
27+
}
28+
});

0 commit comments

Comments
 (0)