Allow assign all attributes as props #282
Replies: 7 comments 10 replies
-
Maybe it's because I'm not familiar enough with React but I don't understand the Motivation section. I find this proposal confusing (as acknowledged in the Drawbacks section) and I don't get what the benefits or use-cases are. Could you provide a bit more context or give an example of some use-case that would be better with this RFC? |
Beta Was this translation helpful? Give feedback.
-
I'm not implying that the plugin would be the only way. Vanilla JS doesn't have types at all, so it can just use the TS would benefit from using its typing system to define the props (and maybe a plugin generates the required runtime property). The current way is a bit clumsy in TS today.
Neither did you in your "quick prototyping" example. |
Beta Was this translation helpful? Give feedback.
-
can we make components with non defined props automatically assign $attr as $prop? |
Beta Was this translation helpful? Give feedback.
-
I think the TS experience with the Options API could be hugely improved with this change. If users could opt out of component props runtime validation, then TS and Volar would handle all we need. See vuejs/core#7832 and https://github.com/vuejs/core/issues/7833 |
Beta Was this translation helpful? Give feedback.
-
Why not just make a |
Beta Was this translation helpful? Give feedback.
-
This needs to see more support. Typing/declaring props always feels really awkward. I found at least 1 2 3 libraries (not even mentioning I would love to use something like this: v.defineComponent({
setup(
props: MyProps,
ctx: SetupContext<
MyEmits,
SlotsType<MySlots>
>
) {}
}) which seems to type-check fine RN, but props are not correctly passed to such component during runtime. |
Beta Was this translation helpful? Give feedback.
-
I'm 100% onboard this. In my opinion, this is the major limitation that we have right now to properly support TypeScript and I've seen confusion between the Vue way and TypeScript way (see first and last code snippet here, respectively). The caveats/differences between every macro are also becoming more problematic. And there's also a |
Beta Was this translation helpful? Give feedback.
-
Discussion Thread for "Allow assign all attributes as props"
Links
Beta Was this translation helpful? Give feedback.
All reactions