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
Reactive fields (If thats that fields marked with $: are) are always any And this causes problems with noImplicitAny (And with regular intellisense)
tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
}
}
app.svelte
<scriptlang="ts">
let value =1;$: foo=value?'foo':'bar'; // foo is `any` here instead of the correct `string`
</script>
{#ifvalue}{foo}{/if}
app.svelte:3:1
Error: Variable 'foo' implicitly has type'any'in some locations where its type cannot be determined. (ts)
alue = 1;
$: foo =
app.svelte:6:13
Error: Variable 'foo' implicitly has an 'any' type. (ts)
if value}{foo}{/if}
Interestingly enough, any other reference made from the reactive field have a correct type again.
So this:
app2.svelte
<scriptlang="ts">
let value =1;$: foo=value?'foo':'bar';let bar =foo;
</script>
{#ifvalue}{bar}{/if}
Works! Svelte-check does not output any errors. (But it's not reactive)
The text was updated successfully, but these errors were encountered:
Reactive fields (If thats that fields marked with
$:
are) are alwaysany
And this causes problems withnoImplicitAny
(And with regular intellisense)tsconfig.json
app.svelte
Interestingly enough, any other reference made from the reactive field have a correct type again.
So this:
app2.svelte
Works! Svelte-check does not output any errors. (But it's not reactive)
The text was updated successfully, but these errors were encountered: