Allow export type along with export = statement #47455
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
Suggestion
π Search Terms
List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.
export =, type
β Viability Checklist
My suggestion meets these guidelines:
β Suggestion
Allow
export interface
andexport type
even when a TypeScript file already contains aexport =
statement.π Motivating Example
Reference this playground, TypeScript currently emits an error.
Previously the community heavily rely on
"esModuleInterop": true
to make CommonJS modules imported as expected in ESM, however with Node's native ESM resolution (nodenext
module resolution), anexport default
is transpiled intoexports.default
, which can't be imported easily:To get rid of this ugly and redundant usage, the community may use
export =
a much more than previous, but then we can't export types along with it.π» Use Cases
For any packages which want to compile into a
module.exports
but also export some types, this is a must have feature:The text was updated successfully, but these errors were encountered: