Skip to content

v-model tsx Types #13971

@ElYaiko

Description

@ElYaiko

Vue version

^3.5.22

Link to minimal reproduction

Steps to reproduce

  1. Define props with tsx:
export default defineComponent({
  props: {
    modelValue: {
      type: Boolean,
      required: true,
    },
  },
  emits: {
    'update:modelValue': (v: boolean) => true,
  },
  1. use the defined modelValue with v-model with tsx
    <Component v-model={}/>

What is expected?

To not throw typing errors, since VModel is defined.

What is actually happening?

Type '{ ref: Ref<CreateComponentPublicInstanceWithMixins<...>> | undefined, CreateComponentPublicInstanceWithMixins<...> | undefined }' 
is not assignable to type 'IntrinsicAttributes & Partial<{}> & Omit<{
  readonly modelValue: boolean;
  readonly "onUpdate:modelValue"?: ((v: boolean) => any) | undefined;
  readonly onSubmit?: ((code: string) => any) | undefined;
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, DefaultKeys<...>>'.

Property 'modelValue' is missing in type '{ ref: Ref<CreateComponentPublicInstanceWithMixins<...>> | undefined, CreateComponentPublicInstanceWithMixins<...> | undefined }' 
but required in type 'Omit<{
  readonly modelValue: boolean;
  readonly "onUpdate:modelValue"?: ((v: boolean) => any) | undefined;
  readonly onSubmit?: ((code: string) => any) | undefined;
} & VNodeProps & AllowedComponentProps & ComponentCustomProps, DefaultKeys<...>>'.

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions