-
Notifications
You must be signed in to change notification settings - Fork 141
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
[BUG] Props object is empty, values in attrs instead #614
Comments
Edit: If you add Problem is here in core: https://github.com/vuejs/core/blob/96eb7452548293c343613ab778248a5da9619f45/packages/runtime-core/src/componentProps.ts#L182 We could do const vals = { ...props, ...attrs }
instance.props = isSSR ? vals : shallowReactive(vals) Merging in Edit: Seems already discussed and denied here: vuejs/core#5730 |
@lmiller1990, it is not a bug, it is how ts works with jsx. In order to make autocomplete work you need a trick like this one |
It's quite messy that we have to define it like that. This isn't the case for
I guess changing stateful components to work like this would break things? I wonder if we could just merge Oh, discussed here already: vuejs/core#5730. In fact it has an RFC https://github.com/pikax/rfcs/blob/no_props_component/active-rfcs/0000-no-props-component.md I wonder if we could merge |
@lmiller1990 this Edit1: |
Yep, I noticed this... this is the main point of confusion, I guess - the same markup I don't know this is something we can really change right now, but I wonder if merging |
I modified some types to make autocomplete work. That is enough for me :) |
I might play around a bit, it's probably not worth the time/effort unless more people are interested in this, in which case we might have to make some code change in core - I don't think we can do this in the babel-plugin. |
Effort - yes. Time - yes^2 (all my time is here). You can play with it, because at first it does not clear how to use vue + jsx + ts. If I find the strength in myself, then I will finish the documentation about this mad Triptych. |
Describe the bug
I am using Vue with TSX. The
props
object does not contain the property I expect. It is available onattrs.foo
, but this is not what I was expecting (maybe I misunderstood how the TSX plugin works)?Possible dup of #607. Posting in English for more 👀 .
I can debug this if it's confirmed to be an actual bug?
Reproduction
https://github.com/lmiller1990/vue-tsx-props-bug
Steps to reproduce
Code is in
src/App.tsx
.System Info
The text was updated successfully, but these errors were encountered: