Skip to content

When creating synthetic default symbol set parent as module symbol #41282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28472,6 +28472,7 @@ namespace ts {
if (hasSyntheticDefault) {
const memberTable = createSymbolTable();
const newSymbol = createSymbol(SymbolFlags.Alias, InternalSymbolName.Default);
newSymbol.parent = originalSymbol;
newSymbol.nameType = getLiteralType("default");
newSymbol.target = resolveSymbol(symbol);
memberTable.set(InternalSymbolName.Default, newSymbol);
Expand Down
28 changes: 28 additions & 0 deletions tests/cases/fourslash/exportEqualNamespaceClassESModuleInterop.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/// <reference path='fourslash.ts'/>

// @esModuleInterop: true
// @moduleResolution: node
// @target: es2015
// @module: esnext

// @Filename: /node_modules/@bar/foo/index.d.ts
//// export = Foo;
//// declare class Foo {}
//// declare namespace Foo {} // class/namespace declaration causes the issue

// @Filename: /node_modules/foo/index.d.ts
//// import * as Foo from "@bar/foo";
//// export = Foo;

// @Filename: /index.ts
//// import Foo from "foo";
//// /**/

goTo.file("/index.ts");
verify.completions({
marker: "",
includes: ["Foo"],
preferences: {
includeCompletionsForModuleExports: true
}
});