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

Typescript Slot-Typings for HyperScript Components #8096

Closed
tada5hi opened this issue Apr 17, 2023 · 1 comment
Closed

Typescript Slot-Typings for HyperScript Components #8096

tada5hi opened this issue Apr 17, 2023 · 1 comment
Labels
✨ feature request New feature or request

Comments

@tada5hi
Copy link

tada5hi commented Apr 17, 2023

What problem does this feature solve?

At the moment slot typings are only available for components that are written in vanilla vue. Components that are written in HyperScript and therefore do not have a template block cannot currently provide typings. Therefore it would be useful to be able to define which (named) slots the component provides, similar to props.

What does the proposed API look like?

The idea here would be that if a type is specified, than it describes the type of the slot property. If no type is specified, it is a slot without slot properties.

import type { PropType } from 'vue';
import { defineComponent } from 'vue';

type SlotType = PropType;
type MyType = {
    attr: string
}

export default defineComponent({
     slots: {
          default: {
                type: Object as SlotType<MyType>,
          },
          named: {
          
          }
     } 
});
@tada5hi tada5hi added the ✨ feature request New feature or request label Apr 17, 2023
@tada5hi tada5hi changed the title Typescript Typings for HyperScript Slots Typescript Slot-Typings for HyperScript Components Apr 17, 2023
@pangao66
Copy link

#7982 defineSlots have been add in vue 3.3.0- appha5

@tada5hi tada5hi closed this as completed Apr 17, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
✨ feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants