johnsoncodehk / vue-tsc

vue-tsc --noEmit && vite build
https://www.npmjs.com/package/vue-tsc
MIT License
241 stars 6 forks source link

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

Closed Shinigami92 closed 3 years ago

Shinigami92 commented 3 years ago

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

johnsoncodehk commented 3 years ago

This is expected, see https://github.com/johnsoncodehk/volar/discussions/146.

Shinigami92 commented 3 years ago

Okay, so I need to wait on https://github.com/vuejs/vue-next/issues/1359 And just use workarounds for this at the moment, okay

Thanks for the incredible fast answer 🚀

Shinigami92 commented 3 years ago

My workaround is now:

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