Closed 9ParsonsB closed 3 years ago
To me this is a bug within the svelte-loading-spinners
library. It copies the unpreprocessed files written in TypeScript into dist/ts
and tells TypeScript to look there for the type definitions. But within that there are no type definitions but real Svelte files, and they have import paths which are wrong because the build script apparently contains a little bug there not rewriting the import paths or something.
The tsconfig exclude
does not mean that things inside node_modules
are not completely excluded from the check. If a file that matches the include pattern (App.svelte
) references something that matches the exclude pattern (svelte-loading-spinners
), it's still included into the list of files and therefore checked.
One can tell TypeScript through skipLibCheck
to skip checking of d.ts
files, which is mostly used to skip diagnostics on node_modules, because TypeScript will mostly see those within node_modules. But in this case real Svelte files are referenced and that skip flag does not apply. One could argue the flag should be interpreted as "also skip Svelte files inside node_modules" in the context of svelte-check
but I'm not very convinced that this is a good idea yet, especially since TypeScript will also throw errors on .ts
files that are wrong and inside node_modules.
So to summarize, the library in question needs to change its build output and provide real d.ts
type definitions of Svelte files instead of using a hacky workaround. For now this most likely means writing these by hand, but we are working on automating this in the context of SvelteKit.
Describe the bug
svelte-check
reports errors in node_modules when referencing a tsconfig - even for files that are not referenced and/or in theexclude
in thetsconfig.json
To Reproduce repo
"svelte-loading-spinners": "0.1.5"
)yarn install
svelte-check --tsconfig tsconfig.json
Expected behavior Files in
node_modules
are excluded unless explicitly referenced or included (?)System (please complete the following information):
svelte-check
Additional context