docs: add note about typing children as Snippet in $props (#17534)

* docs: add note about typing children as Snippet in \$props

* Apply suggestion from @Rich-Harris

* Apply suggestion from @Rich-Harris

---------

Co-authored-by: gokul.d <gokul.d@juspay.in>
Co-authored-by: Rich Harris <hello@rich-harris.dev>
pull/17541/head
Gokul 3 months ago committed by GitHub
parent fe12ffc2a3
commit c041d122ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -198,6 +198,8 @@ You can, of course, separate the type declaration from the annotation:
> [!NOTE] Interfaces for native DOM elements are provided in the `svelte/elements` module (see [Typing wrapper components](typescript#Typing-wrapper-components))
If your component exposes [snippet](snippet) props like `children`, these should be typed using the `Snippet` interface imported from `'svelte'` — see [Typing snippets](snippet#Typing-snippets) for examples.
Adding types is recommended, as it ensures that people using your component can easily discover which props they should provide.

Loading…
Cancel
Save