New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type mismatch on v-model #512
Comments
The solution depends on the actual situation and your needs, you can do
And typescript is supported in template now: https://twitter.com/youyuxi/status/1439304854028029953 |
Thanks for your response and info @johnsoncodehk. On further investigation...
The only solution I've found that compiles and throws no IDE error is to replace v-model with the following: <textarea
:value="lbe_columns[index].data as string" @keyup="evt => lbe_columns[index].data = (evt.target as HTMLTextAreaElement).value">
</textarea> The problem is that this isn't exactly semantic and bypassing v-model with v-bind/@event combo. It's interesting to note that v-bind expressions allow TS typehint ps. thanks for your excellent work on Volar 👍🙂 |
Doubt this is a bug but wondering the best workaround, since switching to volar it's reporting error in the template. I have an object along the lines of the following:
Then in my SFC:
Volar shows an ts2322 (not assignable to type) error on 'v-model' because the type description on
TextareaHTMLAttributes.value
isstring | number | string[] | undefined
, where my type has the possibility ofdata
being aDate
type.I'm wondering the best way to handle such situations. In real world
entry
is an array of Lbe objects with data for textarea, input and a custom component which has Date for the data. We can't use type annotation in the template, so what's the best workaround here?TIA 🙂
The text was updated successfully, but these errors were encountered: