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
Passing an undeclared prop to a component, e.g. <TextComponent unknownProp="foop" />, causes a type error. This behavior appears to work even if the prop name is an HTML attribute name such as role or title. However, when the prop name contains a dash (-) character (such as in the case of aria-* props like aria-live or aria-hidden) no type error is thrown.
Reproduction
This issue can be reproduced using the below example components: App.svelte
This only happens in the old (JSX) transformation and it is a limitation in Typescript with JSX type check. If you use the new transformation (see #1352 for how to turn it on; it will be the new default, soon), it will work as expected.
Describe the bug
Passing an undeclared prop to a component, e.g.
<TextComponent unknownProp="foop" />
, causes a type error. This behavior appears to work even if the prop name is an HTML attribute name such asrole
ortitle
. However, when the prop name contains a dash (-
) character (such as in the case ofaria-*
props likearia-live
oraria-hidden
) no type error is thrown.Reproduction
This issue can be reproduced using the below example components:
App.svelte
TestComponent.svelte
Expected behaviour
Type checking the reproduction example (via
svelte-check
):TestComponent
proptext
as valid (expected)TestComponent
propunknownProp
as invalid (expected)TestComponent
propunknown-prop
as valid (unexpected)The expected behavior would be that both
unknownProp
andunknown-prop
are type checked as invalid, since the component only declares atext
prop.System Info
svelte
@3.50.1
svelte-check
@2.9.1
svelte-preprocess
@4.10.7
Which package is the issue about?
svelte-check
Additional Information, eg. Screenshots
No response
The text was updated successfully, but these errors were encountered: