-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Reexported types are emitted in js files #38647
Comments
This was a known break scheduled for 3.9. (It should have been mentioned in the release announcement). Specifically, in the case of You should endeavor to move the types directly into the module reexporting them, if you do not actually expect a file to be present at runtime corresponding to that declaration file (the locations of module declaration files correlate to valid runtime import paths). Failing that, explicit reexports of the types in question imported via |
Is that possible to have a tsconfig flag to prevent emitting empty import? export * is usually used in index.ts which sometimes import .d.ts declaration files should not get emitted. |
@stephenzsy export type * from "types" Since this is supported: export type { MyType } from "types" |
It will be great if the following suggestion #37238 can be implemented |
This issue has been marked 'Working as Intended' and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
@weswigham as a counter example we're re-exporting types automatically generated from JSON Schema (using https://github.com/bcherny/json-schema-to-typescript). We generate multiple files, some of which include 1k+ types over 3k+ lines. It's not practical to move them into modules or use named exports. Another vote for #37238 as a workable solution to this. |
Reexported types are emitted as actual modules in js files generating runtime errors.
Problem occurs in both commonjs and esmodule.
TypeScript Version: 3.8.3
Search Terms:
Reexported types interfaces dts
Code
tsconfig
Expected behavior:
Don't emit types reexports
Actual behavior:
commonjs
esnext
The text was updated successfully, but these errors were encountered: