Subscribe on changes!

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

avatar
Jan 29th 2023

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 https://github.com/vuejs/core/blob/e340add5a541df5d6563e24b11551b0d161d2f38/packages/runtime-dom/types/jsx.d.ts#L474

System Info

No response

Any additional comments?

This was first reported at https://github.com/johnsoncodehk/volar/issues/2341. The suggested solution fixes the type error, however it then prevents utilising const toggle as a string in the script.

avatar
Jan 31st 2023
avatar
Jan 31st 2023

So I think this is a volar type checking problem.

@johnsoncodehk cc