You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
tsc ignores errors in folders named internal in dependencies at a minimum. There may be more situations in which it ignores errors and it seems that svelte-check does not faithfully reproduce these conditions.
To simulate having an erroring dependency create a node_modules/dependency/internal/index.js file with the contents:
constarray=[1,2,3];constitem: number=array[4];// Only an error when noUncheckedIndexedAccess is set to true.
Create a node_modules/dependency/index.js file with the contents import "./internal/index.js";
Create a reproduction.svelte file with the contents:
<scriptlang="ts">
import"dependency";
</script>
Run ./node_modules/svelte-check/bin/svelte-check
You should get this error:
====================================
Loading svelte-check in workspace: svelte-check-reproduction
Getting Svelte diagnostics...
svelte-check-reproduction/node_modules/dependency/index.ts:3:7
Error: Type 'number | undefined' is not assignable to type 'number'.
Type 'undefined' is not assignable to type 'number'.
const item: number = array[4]; // Only an error when noUncheckedIndexedAccess and strictNullChecks is set to true.
====================================
svelte-check found 1 error and 0 warnings in 1 file
Expected behaviour
I expected no error.
For example in my zip I have a noIssue.ts file with the contents:
import"dependency";
You will not see the issue when you run ./node_modules/typescript/bin/tsc --noEmit nor ./node_modules/svelte-check/bin/svelte-check.
You won't even get an error if you run svelte-check or tsc on the results of svelte2tsx on the contents of reproduction.svelte like so:
I can't reproduce this I get the error in both tsc and svelte-check. I think you might make some mistake while preparing the reproduction. The dependency/index.ts in your zip is actually import 'internal/index.ts' instead of import './internal/index.ts'.
Describe the bug
tsc
ignores errors in folders namedinternal
in dependencies at a minimum. There may be more situations in which it ignores errors and it seems thatsvelte-check
does not faithfully reproduce these conditions.Reproduction
You can download this zip svelte-check-reproduction.zip and then:
npm install
.dependency
folder intonode_modules
(if you do this too early it will be deleted)../node_modules/typescript/bin/tsc --noEmit
and you won't get an error innoIssue.ts
./node_modules/svelte-check/bin/svelte-check
and get an error because ofreproduction.svelte
.Alternatively if you want to create this situation from scratch:
npm init
or whatever your preferred package manager is.npm install svelte-check
.tsconfig.json
with these contents:node_modules/dependency/internal/index.js
file with the contents:node_modules/dependency/index.js
file with the contentsimport "./internal/index.js";
reproduction.svelte
file with the contents:./node_modules/svelte-check/bin/svelte-check
You should get this error:
Expected behaviour
I expected no error.
For example in my zip I have a
noIssue.ts
file with the contents:You will not see the issue when you run
./node_modules/typescript/bin/tsc --noEmit
nor./node_modules/svelte-check/bin/svelte-check
.You won't even get an error if you run
svelte-check
ortsc
on the results ofsvelte2tsx
on the contents ofreproduction.svelte
like so:(you will need to set the
package.json
type to"type": "module"
).This results in:
Which does not error (after you resolve the missing dependencies).
System Info
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: