这是indexloc提供的服务,不要输入任何密码
Skip to content

Generates empty .d.ts declaration file #762

@IanVS

Description

@IanVS

Hi! I'm working on some changes in Storybook, and I've come across a problem. I have an entry file that is only performing a function call, without any exports. When I run it through tsup, with the dts option set, I get an empty declaration file. Typescript itself puts export {} in the .d.ts file, so that it is still treated as a module and avoids errors in other modules that import it (for side-effects, for example).

Here's an example typescript playground which shows the .d.ts being created as export {}: https://www.typescriptlang.org/play?target=7&module=1&isolatedModules=true&allowSyntheticDefaultImports=false&ts=4.8.4#code/JYWwDg9gTgLgBGAhjAFnAZlCI4HImq4DcAsAFDnoCuAdgMYzAQ1xQCmA5sAM4xtQAKAJRwA3uThw6zbhAA2bAHRyIHAbgAmEOIjipgNDriGkyAX3Ll2XXv2GmgA

But, when I create such a file with tsup and compile it, I get an empty file.

Please let me know if I can do anything to help troubleshoot or solve this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions