Typescript defineModel() on child component with textarea cannot assign v-model with parent reactive value
Vue version
3.4.7
Link to minimal reproduction
Steps to reproduce
- inspect error on the SFC playground link:
error TS2322: Type 'unknown' is not assignable to type 'string | number | readonly string[]'.
More info on runtime error using typescript compliler:
node_modules/@vue/runtime-dom/dist/runtime-dom.d.ts:709:5
709 value?: string | ReadonlyArray
What is expected?
No typescript error.
What is actually happening?
It looks like the value of the textarea is not being bound correctly via defineModel. Reactivity works perfectly with the binding, but the error is still thrown.
This approach works on every other html element I've tried (checkbox, text, select, etc)
System Info
No response
Any additional comments?
No response
You haven't defined a type for the model, so it's unknown - you should do that, that's why you are using typescript, presumably
defineModel<string>()