Skip to content

Commit afae0a2

Browse files
committed
When creating synthetic default symbol set parent as module symbol
Fixes #40684
1 parent 489fc45 commit afae0a2

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28472,6 +28472,7 @@ namespace ts {
2847228472
if (hasSyntheticDefault) {
2847328473
const memberTable = createSymbolTable();
2847428474
const newSymbol = createSymbol(SymbolFlags.Alias, InternalSymbolName.Default);
28475+
newSymbol.parent = originalSymbol;
2847528476
newSymbol.nameType = getLiteralType("default");
2847628477
newSymbol.target = resolveSymbol(symbol);
2847728478
memberTable.set(InternalSymbolName.Default, newSymbol);
Lines changed: 28 additions & 0 deletions
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)