v-else-if does not report TS error in some cases #5157
Labels
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.2.0
VSCode version
1.96.4
Vue version
3.5.13
TypeScript version
5.7.2
System Info
package.json dependencies
Steps to reproduce
presentation
possibly being undefined for thev-else-if="presentation.stream && isPresentationPrimary"
below - notice that you now got an error as expected
What is expected?
vue-tsc should throw an error about
presentation
possibly being undefined.What is actually happening?
No errors, compiles just fine
Link to minimal reproduction
https://play.vuejs.org/#eNqVk1Fr2zAQx7/KVQ9tConDyPbiuYFt9GGDbWXJo2Bo9tlRK0tCkp2UNN99J5lkzggdexBId3/d/e502rMP1mZ9hyxnhS+dtAE8hs6CErq54yx4zpZcy9YaF2APDms4QO1MCzd07YZrrsOzRXhw6FEHEaTRcAd7rgG86VyJOXCmTCkUZ/BCe4etCcjZ+yQJDkWbw1espFilA9kPtLgujfYBpB+HfnCyFe6ZMhBJ8csYhUIvJ8F1eDu6ZM9povYM8AU6XWEtNVbLSbxYzIfqqVY6BGytEgHpBFBUsk8b2lroZ7KmvlxdxKJenaWRHrSJNMlbzG0KnyJdzWaw3pCgMjiotsY9waSV3kvdwHoF6JxxtznMZuP0qDwODOMis6GRcH19uWFEttqY7XljhD+iTUHWIAPgTvrgB1BK+DdrRPQwaWRPzBcJo/TfmP9Nc8xQzIfHKOanJ2JTGlJ69Vo22aM3miY5DR9npWmtVOi+2xifBjkfxjL6hFJm+yXZ4uxMj/Zyg+XTBfuj30UbZ6m3rqf5PfmCcA2GwX2/+oY72p+crak6RepXnD/QG9VFxkH2kWaTsEe6RPs5/UGajbW/3wXU/lhUBI3KQ9JzRv/y0yul/8FdZG/TPfpw1MWfPboYkxq4yN5lbxbs8BtRSmP7
Any additional comments?
Even though the v-else-if is verbose in adding the
&& isPresentationPrimary
which is not needed logically, I would assume Typescript / vue-tsc to still complain.The text was updated successfully, but these errors were encountered: