Describe the bug
TypeScript's new type narrowing behavior is causing svelte-check to emit This comparison appears to be unintentional because the types '...' and '...' have no overlap. on a variable when its value is mutated via binding.
Note this change is only currently affecting top-level variables. Union types also include boolean and enum types.
Reproduction
<script lang="ts">let checked = true;</script>
<input type="checkbox" bind:checked />
{#if checked === false}false{/if}
Expected behaviour
svelte-check should pass with no errors. Since bound expressions are type checked as covariant to the prop's type, the target variable's effective type ought to be widened to the entire union type.
System Info
svelte-check 3.6.7
- OS: Windows 10
- IDE: VSCode
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
Describe the bug
TypeScript's new type narrowing behavior is causing svelte-check to emit
This comparison appears to be unintentional because the types '...' and '...' have no overlap.on a variable when its value is mutated via binding.Note this change is only currently affecting top-level variables. Union types also include boolean and enum types.
Reproduction
Expected behaviour
svelte-check should pass with no errors. Since bound expressions are type checked as covariant to the prop's type, the target variable's effective type ought to be widened to the entire union type.
System Info
svelte-check 3.6.7
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response