Skip to content

TypeScript documentation not updated for vue 3.3 typed slots #2371

Open

Description

@swantzter

vuejs/core#7982 introduced typing of slots, and it was announced in the release post, however I can't find anything in the docs on how to use this new feature, not in the slots documentation neither in the TypeScript (composition / options) sections, the only information I found on how to use this new feature was in the PR itself.

It would be nice to get this added to the docs

Activity

  1. SimonSimCity commented on May 17, 2023

    @SimonSimCity

    The docs mention it here: https://vuejs.org/api/sfc-script-setup.html#defineslots

    But might be good to create a cross reference at the places you mentioned...

  2. swantzter commented on May 17, 2023

    @swantzter
    Author

    Yeah, after searching a bit more I see the options API version is also available at https://vuejs.org/api/options-rendering.html#slots but neither this one nor the one you mentioned comes near the top when you use the search and search for "slots", or is linked to in those pages

  3. volarname commented on May 29, 2023

    @volarname

    what about example with no props ?

  4. volarname commented on May 29, 2023

    @volarname

    also looks like current code is mistake
    documentation:

    default(props: { msg: string }): any
    

    should be:

    default?: (props: { msg: string }) => any
    

    or?

  5. jd-solanki commented on May 29, 2023

    @jd-solanki
    Contributor

    also looks like current code is mistake documentation:

    default(props: { msg: string }): any
    

    should be:

    default?: (props: { msg: string }) => any
    

    or?

    Both are valid syntax. Please refer to PR for more details.

    Use default?: (props: any) => any for no props.

  6. dilipsaroj commented on Oct 16, 2026

    @dilipsaroj

    Hi! This still looks open: the TypeScript guide covers props, emits, refs, etc., but has no section on typing slots.

    I'm planning to add a "Typing Component Slots" section to guide/typescript/composition-api, covering defineSlots usage and slot forwarding. Details in #3475. I'll link the PR here once it's up.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions