Skip to content

docs: add Typing Component Slots section to TypeScript guide - #3479

Open
dilipsaroj wants to merge 1 commit into
vuejs:mainfrom
dilipsaroj:docs/typing-component-slots
Open

dilipsaroj wants to merge 1 commit into
vuejs:mainfrom
dilipsaroj:docs/typing-component-slots

Conversation

@dilipsaroj

@dilipsaroj dilipsaroj commented Oct 16, 2026 •

Copy link
Copy Markdown

Description of Problem

The TypeScript with Composition API guide documents typing props and emits, but not slots. defineSlots() is only covered in the API reference.

Forwarding slot props in a recursive component (<slot v-bind="slotProps" />) also gives TS7022 ('slotProps' implicitly has type 'any'), and the docs don't explain how to fix it.

Proposed Solution

Add a "Typing Component Slots" section to guide/typescript/composition-api.md:

  • basic defineSlots() usage, linking to the API reference
  • a "Forwarding Slots in Recursive Components" subsection showing that declaring the slot type with defineSlots() fixes the TS7022 error

Additional Information

I checked both examples with vue-tsc (Vue 3.5, TypeScript 5.9). Without defineSlots() the recursive example reports TS7022; with it, it type-checks.

Closes #3475
Part of #2371

@netlify

netlify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vuejs ready!

Name Link
🔨 Latest commit 32600c6
🔍 Latest deploy log https://app.netlify.com/projects/vuejs/deploys/6ad1d8881e8bece3f67d6704
😎 Deploy Preview https://deploy-preview-3479--vuejs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slots in recursive components

1 participant