Skip to content

Emit 'export as namespace ts' in our bundled d.ts output #53570

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

Closed
wants to merge 2 commits into from

Conversation

jakebailey
Copy link
Member

@jakebailey jakebailey commented Mar 29, 2023

I was reading https://johnnyreilly.com/definitely-typed-the-movie and saw the export as namespace syntax, which triggered a memory that made me remember that we used to have this in our output pre-modules, but I did not preserve it.

Before, we had:

  • typescript.d.ts, which only had export = ts
  • tsserverlibrary.d.ts, which had both export = ts and export as namespace ts.
  • typescriptServices.d.ts, which just declared the ts namespace without exporting it.

Given we still let ts be loaded on the globals if not in CJS, this seems like it's correct to say that there's a global ts namespace when not imported.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Mar 29, 2023
@jakebailey jakebailey added this to the TypeScript 5.0.3 milestone Mar 29, 2023
@fatcerberus
Copy link

Wait, typescript.d.ts and typescriptServices.d.ts were different despite that the corresponding .js files were identical?

@jakebailey
Copy link
Member Author

Yes, yes they were!

@jakebailey
Copy link
Member Author

jakebailey commented Mar 29, 2023

@DanielRosenwasser I stuck this in 5.0.3 as this feels like something we should backport for the patch release?

Not totally sure how to test that this doesn't negatively impact anyone but I'm pretty sure it does not.

@DanielRosenwasser
Copy link
Member

I'm confused, didn't we say these files shouldn't contain an export as namespace in chat?

@jakebailey
Copy link
Member Author

jakebailey commented Mar 29, 2023

I think we started with "nobody's complaining, so why bother", but Andrew (and I, originally) seemed to think that if the output file would put itself into the globals when not loaded via an import that it should declare so.

@jakebailey jakebailey marked this pull request as draft March 30, 2023 21:02
@jakebailey
Copy link
Member Author

We're like 10 months post-module migration; given nobody has complained about this I'm just going to close this. If we ever want to change that, we can still revive this, but I really suspect anyone who wants us in a browser is just bundling anyhow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants