Issue Recap
In Vue3, can Pinia getters be utilized as a watch target's first argument?
System Details
- Vue version: 3.2.13
- Pinia version: 2.1.4
- TypeScript version: 4.5.5
Problem Description
An error was encountered when attempting to reference the getter of a Pinia store object as the initial argument in a watch function.
Error message code: ts(2769)
Code Example
watch(myStore.getExample, (newValue, oldValue) => {
...
})
It is known that Pinia getters are akin to read-only variables similar to Vue3 computed properties.
Considering that computed properties make use of proxy pattern, should Pinia getters be exported as functions instead?