I have been running into an issue trying to cast Vue props to their types. If I attempt to cast them using
testIntProp: Object as () => TestInt
in the prop definition, within the prop section, the type is
PropValidator<TestInt> but if I then reference that prop in a computed function, it shows it as an any. This is for both for built-in types as well as interfaces/types that I define. If I define a new variable in the computed function and cast the type there, then all works as expected but I would rather avoid that. However, if I don’t do it that way, I get the following compile error in testOne():
Property 'TestField' does not exist on type 'ComputedOptions<any> | (() => any)'. Property 'TestField' does not exist on type 'ComputedOptions<any>'.
I also already have ‘strict’ set to true in my ts.config file.
Here are some pictures showing my issue:
Thanks in advanced!