Skip to content
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

Wrap types in default module in $default namespace and re-export them at top level #888

Merged
merged 2 commits into from Mar 5, 2024

Conversation

jaclarke
Copy link
Member

@jaclarke jaclarke commented Mar 4, 2024

Fixes #882

…em at top level

Fixes references to default types within other modules containing types with the same type name
Comment on lines 201 to 207
if (module.isRoot && module.name === "default") {
for (const [typeName, typeRef] of module.types) {
plainTypesCode.writeln([`import ${typeName} = ${typeRef};`]);
}
plainTypesCode.writeln([
`export {${[...module.types.keys()].join(", ")}};`,
]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this is already covered by the existing tests in interfaces.test.ts, but do you think it'd be easy to write a quick check for the pathological case we're fixing here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some tests and fixes some bugs.

Copy link
Collaborator

@scotttrinh scotttrinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👏

Thanks for taking this on!

@scotttrinh scotttrinh merged commit 6c7de1a into master Mar 5, 2024
7 of 8 checks passed
@scotttrinh scotttrinh deleted the interfaces-default-namespace branch March 5, 2024 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants