-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesHelp WantedYou can do thisYou can do this
Milestone
Description
Bug Report
When generating type declaration files if a type that is only used inside the typescript code however it is not exported results in an empty export at the end of the file e.g. export {};
🔎 Search Terms
- declaration empty export
- declaration "export {}"
🕗 Version & Regression Information
When i started inspecting the generated typescript declarations generated.
I see the same error/behaviour when either typescript@4.8 and typescript@next
This is the behavior in every version I tried, and I reviewed the FAQ for entries about emmited code and private fields and methods.
⏯ Playground Link
- When some of the types are not exported this happens playground example here
- When all of the types are exported there is no empty export playground example here
💻 Code
Empty Export Code
type TaskType = 'ONE' | 'TWO' | 'THREE';
// would not expected to have an empty export
// in the emitted type declaration code here is this correct?
export interface Task {
executeTask(type:TaskType):void;
}No Empty Export
// no empty export since all types and interfaces exported
export type TaskType = 'ONE' | 'TWO' | 'THREE';
export interface Task {
executeTask(type:TaskType):void;
}🙁 Actual behavior
Empty export for some reason…
🙂 Expected behavior
No default empty export.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: Declaration EmitThe issue relates to the emission of d.ts filesThe issue relates to the emission of d.ts filesHelp WantedYou can do thisYou can do this