Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TypeScript With Slots section #2431

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/guide/components/slots.md
Original file line number Diff line number Diff line change
Expand Up @@ -508,3 +508,8 @@ An example renderless component could be one that encapsulates the logic of trac
While an interesting pattern, most of what can be achieved with Renderless Components can be achieved in a more efficient fashion with Composition API, without incurring the overhead of extra component nesting. Later, we will see how we can implement the same mouse tracking functionality as a [Composable](/guide/reusability/composables).

That said, scoped slots are still useful in cases where we need to both encapsulate logic **and** compose visual output, like in the `<FancyList>` example.


## TypeScript With Slots <sup class="vt-badge ts"/>

Slots can be typed with `defineSlots()` to give hints to your IDE for slot name and prop type checking. [Learn more about the `defineSlots()` macro](https://vuejs.org/api/sfc-script-setup.html#defineslots)