question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItĀ collects links to all the places you might be looking at while hunting down a tough bug.

And, if youā€™re still stuck at the end, weā€™re happy to hop on a call to see how we can help out.

Possible to skipLibCheck while still checking final output?

See original GitHub issue

Hi, and thanks for your work on dts-bundle-generator!

I am converting a Node project from Jest to Vitest and dts-bundle-generator is complaining about missing types for a transitive dependency. vitest installs jsdom which installs ws, and @types/ws are not included, so ws is of type any. I can fix it by installing @types/ws in my project, but Iā€™d prefer an alternative since that package really has nothing to do with my project. Using --no-check works, but that feels somewhat unsafe (or at least, not quite as robust/safe as it is now). Thoughts?

(Note: none of the above ever make it into my bundled types, so Iā€™m not sure why itā€™s tripping up the check.)

> dts-bundle-generator --silent --umd-module-name my-project --out-file dist/my-project.d.ts src/my-project.ts

node_modules/vite/dist/node/index.d.ts(51,47): error TS7016: Could not find a declaration file for module 'ws'. 'C:/projects/my-project/node_modules/ws/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`
node_modules/vite/dist/node/index.d.ts(52,54): error TS7016: Could not find a declaration file for module 'ws'. 'C:/projects/my-project/node_modules/ws/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`
Error: Compiled with errors

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
timocovcommented, Apr 10, 2022

No worries thatā€™s alright šŸ˜‚ I understand your feeling - I was thinking exactly the same previously and I was quite surprised that it works in this way.

Btw this is exactly why I would never suggest to use this option - it might hide some important errors if youā€™re relying on the compiler a lot (and its type system/errors).

0reactions
wKovacs64commented, Apr 10, 2022

Yep, youā€™re right - that was the point of confusion. I was always under the impression skipLibCheck only applied to node_modules for some reason. šŸ¤Æ (I think because at one point, it was recommended as a solution if some types out of your control were incorrect or conflicting.) Wellā€¦ now I need to go rethink my life. Sorry for the noise, and thanks for walking through it with me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding TypeScript's skipLibCheck Once and For All
According to TypeScript's official documentation, skipLibCheck will ā€œskip type checking of declaration files.ā€ Let's try clarifying it. WhenĀ ...
Read more >
skipLibCheck: true is ignored when package's types field ...
Actual behavior: When skipLibCheck is set to true , TS will still have type errors in packages in node_modules . It seems that...
Read more >
TSConfig Option: skipLibCheck
TSConfig. skipLibCheck. Skip type checking of declaration files. This can save time during compilation at the expense of type-system accuracy.
Read more >
skip library check only in node_modules - typescript
There is no granular control over type checking, you either check all declaration files or none unfortunately. From compiler code: export ...
Read more >
TypeScript: the skipLibCheck Option Explained
With skipLibCheck TypeScript still checks your code against the types in the declaration ( .d.ts ) files, but it does not check theĀ ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found