v-if check with union type no longer narrows type since v2.1.8 #4973
Labels
bug
Something isn't working
good reproduction ✨
This issue provides a good reproduction, we will be able to investigate it first
🔨 p3-minor-bug
Vue - Official extension or vue-tsc version
2.1.8
VSCode version
1.95.0
Vue version
3.5.12
TypeScript version
5.6.3
System Info
No response
package.json dependencies
No response
Steps to reproduce
Hover over the type of the second div with "condition" const and see that it has a type "never"
What is expected?
After checking the first condition with v-if, the second condition type should have type "B"
What is actually happening?
After checking the first condition with v-if, the second condition type no longer narrows the union type, and instead gives "never". This seems to be a regression introduced since v2.1.8 since it has worked in v.2.1.6
Link to minimal reproduction
https://play.vuejs.org/#eNp9kUFPhDAQhf9KM5e9rGzUeFnBBMwe9KBGPTYxBAbsWtqmLUiy8t+dQpblsNkLMPO+ebxpD5AaE3UtwhZiV1hhPHPoW8NkruqEg3ccHrgqtHKe0bMUXmi1ZYxDyoH90TvjkEzlPVfxZnKhGSo8NkbmHqliLC5Fx7orUZHt7MSSJGGrdEVemyWF0uFZNAvoyMabhT2sKSqhlaijvdOK9jkEuzDfGCHRvppgQuts2agELZdS/z6PvSqnP66PQvGNxc8keNue+nvXhx6HN4sObYccZs3ntkY/ybuPF+zpexYbXbaS6AviOzot2xBywrJWlZR7wY1xnxqjrReq/nS73qNyx61C0EAOI8+BbvXxwu6nuLfR3TjH1UDH+NWhDZ50giRE1zcw/AN2jbAd
Any additional comments?
No response
The text was updated successfully, but these errors were encountered: