Closed davidglezz closed 3 months ago
2.0.28 & 2.0.29
1.91.1
3.4.35
5.5.4
System: OS: macOS 14.4.1 CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz Memory: 43.05 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.15.0 - ~/.nvm/versions/node/v20.15.0/bin/node npm: 10.8.1 - ~/.nvm/versions/node/v20.15.0/bin/npm pnpm: 9.6.0 - ~/.nvm/versions/node/v20.15.0/bin/pnpm Watchman: 2024.04.01.00 - /usr/local/bin/watchman
const msg = defineModel('msg', { type: String as PropType<string | null>, default: null, });
<template> <Child v-model:msg="msg" /> </template> <script lang="ts" setup> const msg = ref<string | null>('test'); </script>
Running vue-tsc or in vscode:
vue-tsc
error TS2322: Type 'string | null' is not assignable to type 'string | undefined'. 163 v-model:msg="msg"
For default v-model looks like it works, but for v-model arguments it fail.
v-model
It should be correctly inferred as string | null and therefore not fail.
string | null
In 2.0.28 Error, in 2.0.26 No error
https://stackblitz.com/edit/vitejs-vite-teuagl?file=src%2FApp.vue
No typecheck on stackblitz? :(
Thank you so much for this amazing and invaluable piece of software.
Vue - Official extension or vue-tsc version
2.0.28 & 2.0.29
VSCode version
1.91.1
Vue version
3.4.35
TypeScript version
5.5.4
System Info
Steps to reproduce
child.vue
parent.vue
Running
vue-tsc
or in vscode:For default
v-model
looks like it works, but for v-model arguments it fail.What is expected?
It should be correctly inferred as
string | null
and therefore not fail.What is actually happening?
In 2.0.28 Error, in 2.0.26 No error
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-teuagl?file=src%2FApp.vue
No typecheck on stackblitz? :(
Any additional comments?
Thank you so much for this amazing and invaluable piece of software.