Types of watch functions not inferred.
cefn opened this issue · comments
When using the watch option with Typescript I was surprised that watch function arguments weren't inferred from the options, although each named property is well-defined on vue this
.
Possible values of newMsg
and oldMsg
below should both be the well-constrained type of this.msg
.
The result is that arguments are always any
. Any manual type assertions added as a workaround could be errored, defeating the purpose of typing.
Is this something which is possible or likely to be fixed, and is there any workaround?
I raised a simple reference branch to share the configuration and options invocation I'm using basing it off johnsoncodehk's volar vue2 reference (vue^2
with @vue/composition-api^latest
)
See the implementation of the watch option in this branch at...
https://github.com/cefn/volar-starter/blob/vue2-watcher-typing/src/components/HelloWorld.vue#L44-L48
Stale issue message