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
Commented-out code is thought to be the children of a component. For example, if you pass a component that doesn't expect a children prop then you will encounter an error saying Object literal may only specify known properties, and 'children' does not exist in type 'Props'. Comments should be ignored as the value of the children prop.
Reproduction
let's say you have a component that doesn't take a children prop.
simpleComponent.svelte
<svelte:optionsrunes />
<scriptlang="ts">
let {name, age} =$props<{name:string; age:string}>()
</script>
+page.svelte
<svelte:optionsrunes />
<scriptlang="ts">
importsimpleComponentfrom"$components/simpleComponent/simpleComponent.svelte";
</script>
<simpleComponent>
<!-- any kind of comment or even empty HTML comment will cause the component to think it is being passed the children prop -->
</simpleComponent>
- ignore comments when determining whether or not to add an implicit children prop #2263
- do static analysis of the destructuring to see whether or not children is destructured from `$props()`, and if not, add the implicit children prop if there's a slot. This results in less confusing type errors when transforming to runes mode and using a slot
- ignore comments when determining whether or not to add an implicit children prop #2263
- do static analysis of the destructuring to see whether or not children is destructured from `$props()`, and if not, add the implicit children prop if there's a slot. This results in less confusing type errors when transforming to runes mode and using a slot
Describe the bug
Commented-out code is thought to be the children of a component. For example, if you pass a component that doesn't expect a
children
prop then you will encounter an error sayingObject literal may only specify known properties, and 'children' does not exist in type 'Props'
. Comments should be ignored as the value of thechildren
prop.Reproduction
let's say you have a component that doesn't take a
children
prop.simpleComponent.svelte
+page.svelte
You will get the previously mentioned error.
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: