Skip to content

v-model on checkbox producing typing error when used with true-value and false-value #7601

Open
@roydukkey

Description

@roydukkey

Vue version

3.2.45

Link to minimal reproduction

https://sfc.vuejs.org/#eNpNUEFSwzAM/IrGl8IMSe4lzQxv4OpLmiipiy17bDnQCfk78oRCfZLW0u5qV/UWQr1kVEfVMrpge8ZOE8hrQ/eOFgc2no6wrsB+ni3CtrVNuM8YCplhqZwf0Z602me0Ar4FlH644PBx9l8FiRmrpbe54DdMAk29Tf8YeYEaYW6bByvSpiGawGB7motE2UzIuZjQZFzwkWGFiBNsMEXv4CAXHV41DZ4S332fykSbOBqa4RsyjTgZwrF7+iufZafI74JCr17Uzl+5PtTX5EmCWsvt+vdDzEg4expaiW7ptbowh3RsmjQNJd5rqn2cG6nqmImNwxqTq87RfyaMQqxVodg0bWr7AeznjLA=

Steps to reproduce

Following the directions for true-value and false-value checkboxes, the v-model property warns of an incorrect type.

What is expected?

The true-value and false-value property type should influence the expected types of the v-model property.

What is actually happening?

The v-model property is restrict to

checked?: Booleanish | any[] | Set<any> // for IDE v-model multi-checkbox support

System Info

No response

Any additional comments?

This was first reported at vuejs/language-tools#2341. The suggested solution fixes the type error, however it then prevents utilising const toggle as a string in the script.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions