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

Built .d.ts files contain js code #7571

Open
6 tasks done
mrginglymus opened this issue Feb 27, 2025 · 3 comments · May be fixed by #7575
Open
6 tasks done

Built .d.ts files contain js code #7571

mrginglymus opened this issue Feb 27, 2025 · 3 comments · May be fixed by #7575
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)

Comments

@mrginglymus
Copy link
Contributor

mrginglymus commented Feb 27, 2025

Describe the bug

Found in dist/browser.d.ts, but may be present elsewhere, something is putting executable code in the declaration files.

Image

Reproduction

https://www.npmjs.com/package/vitest?activeTab=code

  1. import vitest/browser
  2. Run tsc with skipLibCheck: false
  3. Observe TS1183 and TS1039 errors

System Info

-

Used Package Manager

npm

Validations

@hi-ogawa
Copy link
Contributor

This looks like a bug of rollup-plugin-dts. Here is a repro https://stackblitz.com/edit/stackblitz-starters-4kre7v8f?file=dist%2Fentry.d.ts It's not likely we get a fix or find a fix since rollup-plugin-dts is in maintenance mode, so probably we should workaround on our side.

@hi-ogawa hi-ogawa added p3-minor-bug An edge case that only affects very specific usage (priority) and removed pending triage labels Feb 27, 2025
@mrginglymus
Copy link
Contributor Author

mrginglymus commented Feb 27, 2025

I tried building vitest using latest master of rollup-plugin-dts:

[!] (plugin dts) TypeError: Cannot read properties of undefined (reading 'forEach')
    at file:///C:/.../rollup-plugin-dts/dist/rollup-plugin-dts.mjs:616:61

:(


tried putting a ? in to get through that error - it completes succesfully but the mergeNamespaces is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants