wonderful-panda / vue-tsx-support

TSX (JSX for TypeScript) support library for Vue
MIT License
578 stars 40 forks source link

value doesn't work with vModel #95

Open Maxim-Mazurok opened 2 years ago

Maxim-Mazurok commented 2 years ago

I want to use my component like this:

<NewFolderDialog vModel={this.newFolderDialogIsActive} />

So I did this:

export default tsx.component({
  name: "NewFolderDialog",
  props: {
    value: {
      type: Boolean as PropType<boolean>,
      required: true,
    },
  },
  model: {
    prop: "value",
    event: "active",
  },
//...

But I'm getting No overload matches this call error: Property 'value' is missing in type '{ vModel: boolean; }' but required in type '{ value: boolean; }'

It'd be great if I could use vModel with value prop in TSX. And even better if I could change the prop name using model.prop.

Workaround for me is to remove required from the value prop. Another workaround would be to "expand" vModel manually.