We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
null
2.1.6
1.93.1
3.5.8
5.6.2
System: OS: macOS 14.6.1 CPU: (10) arm64 Apple M1 Max Memory: 6.20 GB / 64.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node Yarn: 1.22.22 - ~/.yarn/bin/yarn npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm pnpm: 9.9.0 - ~/.nvm/versions/node/v20.16.0/bin/pnpm Browsers: Chrome: 129.0.6668.59 Safari: 18.0 Safari Technology Preview: 18.0
"dependencies": { "vue": "^3.5.6" }, "devDependencies": { "@vitejs/plugin-vue": "^5.1.3", "typescript": "^5.5.3", "vite": "^5.4.6", "vue-tsc": "^2.1.6" }
props: { msg: { type: String, default: null, }, },
msg
<HelloWorld :msg="null" />
No type error
src/App.vue:9:16 - error TS2322: Type 'null' is not assignable to type 'string | undefined'. 9 <HelloWorld :msg="null" />
https://stackblitz.com/edit/vitejs-vite-3fqeyw?file=tsconfig.json,src%2FApp.vue,src%2Fcomponents%2FHelloWorld.vue,package.json&terminal=dev
I'm not sure why is null not allowed. Vue doesn't complain when being passed either undefined or null (see attached reproduction).
undefined
Note: regardless whether null or undefined is passed, Vue sets the value to null within the component.
The text was updated successfully, but these errors were encountered:
It should be a https://github.com/vuejs/core issue.
Sorry, something went wrong.
Actually it appears that I've created such issue there before: vuejs/core#8600
No branches or pull requests
Vue - Official extension or vue-tsc version
2.1.6
VSCode version
1.93.1
Vue version
3.5.8
TypeScript version
5.6.2
System Info
package.json dependencies
Steps to reproduce
null
tomsg
prop from the parent component:What is expected?
No type error
What is actually happening?
Link to minimal reproduction
https://stackblitz.com/edit/vitejs-vite-3fqeyw?file=tsconfig.json,src%2FApp.vue,src%2Fcomponents%2FHelloWorld.vue,package.json&terminal=dev
Any additional comments?
I'm not sure why is
null
not allowed. Vue doesn't complain when being passed eitherundefined
ornull
(see attached reproduction).Note: regardless whether
null
orundefined
is passed, Vue sets the value tonull
within the component.The text was updated successfully, but these errors were encountered: