So, I ran into an interesting situation. Has anyone ever worked with typescript + vue-test-utils and attempted to change a value for testing purposes like this:
wrapper.vm.aCoolRefValueToManipulate = 'something much cooler'
?I gave it a shot, and it actually worked. However, the ts linter didn't take too kindly to it because it was unfamiliar with
aCoolRefValueToManipulate
inside vm
.
Any ideas on how to resolve this issue?
https://i.sstatic.net/cGGqv.png
The linter provided me with this warning:
Property 'showTopDown' does not exist on type '{ $: ComponentInternalInstance; $data: {}; $props: Partial<{}> & Omit<Readonly<ExtractPropTypes<{}>> & VNodeProps & AllowedComponentProps & ComponentCustomProps, never>; ... 10 more ...; $watch(source: string | Function, cb: Function, options?: WatchOptions<...> | undefined): WatchStopHandle; } & Readonly<...> & Sha...'.ts(2339)
Resolution
I received assistance from a helpful individual on the official Vue Discord Server.
(wrapper.vm as any).aCoolRefValueToManipulate