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

How can I export all types in the generated index.d.ts file? #321

Open
LOVETOO opened this issue Oct 29, 2024 · 2 comments
Open

How can I export all types in the generated index.d.ts file? #321

LOVETOO opened this issue Oct 29, 2024 · 2 comments

Comments

@LOVETOO
Copy link

LOVETOO commented Oct 29, 2024

By default, in the generated .d.ts file, only the type of the entry file is exported; but when other projects use this npm package, they need to use more types, and those types are not exported.

Version number:
rollup@4
typescript@5
rollup-plugin-dts@6

@az-oolloow
Copy link

Same question

@eriknoorland
Copy link

eriknoorland commented Jan 4, 2025

I seem to have the same issue. All the d.ts files are compiled to the dist/dts/ folder. However, when running the dts plugin it only takes the contents of dist/dts/index.d.ts and ignores the rest of the d.ts files when "bundling".

It seems that if a type is used in the return type of a function it will be packaged but if it's only referenced in the index.ts file as a type of a function argument it won't get packaged. I've added a little example of when it's not packaged where I would expect Data to be packaged as I would like to reference to it from where this library that I'm building is used.

parser.on('data', (data: Data) => eventEmitter.emit('data', data));

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

3 participants