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

Error using nested namespaces "UnsupportedSyntaxError: namespace must have a "ModuleBlock" body." #79

Open
2 tasks
danielpza opened this issue Aug 7, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@danielpza
Copy link

danielpza commented Aug 7, 2024

Problem

I get this error when trying to compile the following with pkgroll:

UnsupportedSyntaxError: namespace must have a "ModuleBlock" body.

declare namespace foo.bar {
  interface A {
    b: string;
  }
}

export { foo };

Seems related to Swatinem/rollup-plugin-dts#246

Expected behavior

bundles it as is, same output as typescript compiler

Minimal reproduction URL

https://github.com/danielpza/pkgroll-namespace-issue

See https://github.com/danielpza/pkgroll-namespace-issue/actions/runs/10288771843/job/28474986787

Version

2.4.2

Node.js version

22.4.1

Package manager

npm

Operating system

Linux

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work financially will speed up resolution

  • I'm willing to offer financial support
@danielpza danielpza added the bug Something isn't working label Aug 7, 2024
@danielpza danielpza changed the title Error using namespaces UnsupportedSyntaxError: namespace must have a "ModuleBlock" body. Error using nested namespaces "UnsupportedSyntaxError: namespace must have a "ModuleBlock" body." Aug 7, 2024
@privatenumber
Copy link
Owner

Can't open your reproduction repo. Is it private?

I'm curious if this isn't something that can be solved with declare module 'file' {}

@danielpza
Copy link
Author

Can't open your reproduction repo. Is it private?

yes, sorry. Made it public now

@wighawag
Copy link

I have a similar issue and it seems it indeed related to rollup-plugin-dts

for my case I have an issue similar to Swatinem/rollup-plugin-dts#162

It is tagged as wontfix. is there a way to disable rollup-plugin-dts and still benefit from dts ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants