8000 Typed slots by pikax · Pull Request #192 · vuejs/rfcs · GitHub
[go: up one dir, main page]

Skip to content

Typed slots #192

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removing the same slot example
  • Loading branch information
pikax committed Jul 22, 2020
commit 87f24cad3ae685451da610108ce52ce99531cf03
14 changes: 3 additions & 11 deletions active-rfcs/0000-typed-slots.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
- Start Date: 2020-07-22
- Target Major Version: 2.x and 3.x
- Reference Issues:
- Reference Issues:
- Implementation PR:

# Summary
Expand All @@ -10,21 +10,16 @@ Allow to define named `slots` and `argument` in the `typescript` to provide auto
# Basic example

```ts
// default slot
defineComponent({
slots: { item: { value: Number } },
})

// named slots
defineComponent({
slots: {
// slot name `item`
item: { value: Number },
},
// ...
})
```


# Motivation

Having type validation when using `slots`.
Expand All @@ -35,7 +30,6 @@ This will allow to have type inference with using render funcions `h` and it wil

Implementation will be similar to `emit` typings. This can also be used at the run-time to validate the slot as we do with props.


# Drawbacks

This is optional, for large applications this will be useful.
Expand All @@ -46,8 +40,6 @@ There's `web-types.json` (Jetbrains) that describes the slots. AFAIK no solution

# Adoption strategy



# Unresolved questions

Should we do a pure typescript or allow to do similar prop validation?
Should we do a pure typescript or allow to do similar prop validation?
0