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
When you have a generics attribute on a script tag (introduced in #2020), it turns off type checking anytime that generic is used as the type of a prop.
Reproduction
Let's say you have a component items.svelte
<scriptlang="ts"generics="const T extends readonly string[]">
exportlet items:Texportlet currentItem:T[number]
</script>
You can now use this component with any nonsense props. For instance, all of the following pass type checking when none of them should:
jasonlyu123
changed the title
Generics attribute on script tag do not type check props
Generics attribute with const modifier on script tag do not type check props
Jul 23, 2023
Describe the bug
When you have a generics attribute on a script tag (introduced in #2020), it turns off type checking anytime that generic is used as the type of a prop.
Reproduction
Let's say you have a component
items.svelte
You can now use this component with any nonsense props. For instance, all of the following pass type checking when none of them should:
Expected behaviour
None of the above reproduction cases should type check.
However the following case should type check:
Here's the equivalent TypeScript code in the TypeScript playground.
System Info
Relevant packages:
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: