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

Do not use export = in TypeScript declaration files #485

Open
dsherret opened this issue Jan 4, 2023 · 9 comments
Open

Do not use export = in TypeScript declaration files #485

dsherret opened this issue Jan 4, 2023 · 9 comments

Comments

@dsherret
Copy link

dsherret commented Jan 4, 2023

TypeScript may start raising a diagnostic when ESM declaration files use export =. This will cause issues for esm.sh. For example: https://esm.sh/@types/[email protected]/index.d.ts serves up a declaration file that has export = santize in it. I think export = needs to be moved away from.

See microsoft/TypeScript#51321 (comment) for more details.

@ije
Copy link
Member

ije commented Jan 7, 2023

thanks! i will look into it.

@ije
Copy link
Member

ije commented Jan 12, 2023

@dsherret should we rename export = santize to export default santize or just remove it?

@dsherret
Copy link
Author

It should represent the transformed esm code, so I think export = should go to export default? Maybe that doesn't always work easily.

@ije ije closed this as completed in e1f7fda Jan 12, 2023
@ije ije reopened this Jan 12, 2023
@ije
Copy link
Member

ije commented Jan 12, 2023

The testing is failed after resolving export = to export default, i will figure out

@ije
Copy link
Member

ije commented Jan 12, 2023

rename export = or remove it, both break some types, i reverted for now

@dsherret
Copy link
Author

This diagnostic has now landed in TypeScript 5.0. export = is being denied in ambient declaration files. I'm going to change the typescript source in Deno to temporarily allow it though.

@dsherret
Copy link
Author

dsherret commented Sep 11, 2024

This is going to start erroring in Deno 2.0 in order to align with TypeScript as it doesn't make sense for an esm module to have a common js export = microsoft/TypeScript#52109

@ije
Copy link
Member

ije commented Sep 11, 2024

thnaks @dsherret i will look into it!

@dsherret
Copy link
Author

It should be warning now in the latest RC. It might start erroring sometime in the future, but I'm not sure how feasible that is to do.

@ije ije pinned this issue Sep 26, 2024
@ije ije mentioned this issue Oct 14, 2024
16 tasks
@ije ije unpinned this issue Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants