Possible to skipLibCheck while still checking final output?
See original GitHub issueHi, 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:
- Created a year ago
- Comments:8 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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).
Yep, youāre right - that was the point of confusion. I was always under the impression
skipLibCheck
only applied tonode_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.