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

Slot return value should restict type of components #3552

Closed
tobiasdiez opened this issue Sep 10, 2023 · 1 comment
Closed

Slot return value should restict type of components #3552

tobiasdiez opened this issue Sep 10, 2023 · 1 comment

Comments

@tobiasdiez
Copy link

tobiasdiez commented Sep 10, 2023

According to vuejs/core#7982 (comment), the each slot definition can be a function whose return value should restrict what components can be put in that slot. By default, its any or VNode[] which is not restricting anything, but one should be able to specify a certain component.

For example, the restrict slot of a component defined with

defineSlots<{
    default(props: { foo: string; bar: number }): any,
    restict(props: { data: string }): typeof Button[]
  }>()

should only allow Buttons as children.

Playground which also shows that type interference/restriction for children is not working.

@davidmatter
Copy link
Collaborator

Please check if this issue has been resolved in the latest 2.x. If not, feel free to create a new one.

@davidmatter davidmatter closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2024
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

No branches or pull requests

2 participants