`v-model` on checkbox producing typing error when used with `true-value` and `false-value`
Vue version
3.2.45
Link to minimal reproduction
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.
getCheckboxValue define _typeValue and _falseValue type is _trueValue?: any _falseValue?: any
that mean's true-value and false-value is any type of data
Input v-model actual value is _modelValue, toggle's type should be the same as _modelValue type, no same as checked.
So I think this is a volar type checking problem.