'children' is of type 'unknown'.js(18046) #11379
Answered
by
dummdidumm
Theonlyhamstertoh
asked this question in
Q&A
Replies: 3 comments 4 replies
-
I am unfamiliar with Typescript but in the documentation, there is an explanation about typing the props :
|
Beta Was this translation helpful? Give feedback.
1 reply
-
I think you can do this now <script lang="ts">
import type { Snippet } from 'svelte'
let { children } = $props<{ children: Snippet }>()
</script>
<button>{@render children()}</button> |
Beta Was this translation helpful? Give feedback.
2 replies
-
<script lang="ts">
import type { Snippet } from 'svelte'
let { children }: { children: Snippet } = $props()
</script>
<button>{@render children()}</button> |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
dummdidumm
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi! I am trying to play around with Svelte 5. I am trying to replace
slot
with@render children()
instead but it throwing me the type error'children' is of type 'unknown'.js(18046)
. What can I do in typescript to fix this?Dependencies
Beta Was this translation helpful? Give feedback.
All reactions