'Typescript error in Vue 3 on input checkbox with v-bind
The following checkbox
<input
v-model="filter.closed"
true-value="-1"
false-value="0"
type="checkbox"
@change="UpdateFilter()"
/>
creates the typescript error: "Type 'number' is not assignable to type 'any[] | Booleanish | undefined'.ts(2322)"
"filter.closed" is a number indeed. I store all booleans as numbers in my MySQL database. And I told vue to handle -1 as true and 0 as false, but TS (or the linter or whatever is in charge) doesn't seem to recognize this.
I run VSCode with the Volar extension.
I this a bug or can I teach the transpiler somehow to treat -1 as true?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
