johnsoncodehk/vue-tsc

v-if | null check doesn't work for events (?)

Closed this issue · 3 comments

It seems that v-if is not forwarded for event bindings 🤔
But bindings like v-text works

const variable: Ref<Something | null>
const doSomething(x: Something)
button(v-if="variable", v-text="variable.text", @click="doSomething(variable)")
//-                                                                 ~~~~~~~~ cannot be null

image

This is expected, see vuejs/language-tools#146.

Okay, so I need to wait on vuejs/core#1359
And just use workarounds for this at the moment, okay

Thanks for the incredible fast answer 🚀

My workaround is now:

@click="template && openSharedComponentDialog(template.sharedPath)"