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

"const" declarations from .d.ts modules should be marked with "declare" #24

Closed
aleclarson opened this issue May 30, 2019 · 5 comments
Closed

Comments

@aleclarson
Copy link
Contributor

aleclarson commented May 30, 2019

A 'declare' modifier is required for a top level declaration in a .d.ts file.

Repro: https://github.com/aleclarson/repro/tree/rollup-dts-1

I also tested with .ts modules, and that works fine. The problem is only with .d.ts modules.

Note: This also happens with function exports.

@Swatinem
Copy link
Owner

Swatinem commented Jun 3, 2019

the plugin will use whatever code is provided.
If the source .d.ts files are missing declare modifiers (likely because they are hand-written), the plugin will not interfere with that.

@cspotcode
Copy link

@Swatinem shouldn't the plugin add the declare modifier? Is that too messy to implement? As far as I can tell, it is implied by export, so whenever the input has export, the output should have declare.

As I understand it, rollup-plugin-dts is moving the export modifier to a different statement, which means it is changing and breaking the input.

@Swatinem
Copy link
Owner

I think by now I have code that properly adds the missing attributes. Do you have a specific snippet that is failing?

@cspotcode
Copy link

@Swatinem sure, here's a minimal reproduction: https://github.com/cspotcode/repros/tree/Swatinem/rollup-plugin-dts/24

Thanks for taking a look.

Swatinem added a commit that referenced this issue Aug 5, 2020
@Swatinem
Copy link
Owner

Swatinem commented Aug 5, 2020

Ah thanks for the repro case, this was indeed straight forward to fix ;-)

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