const computedGetters: StoreWithGetters<G> = {} as StoreWithGetters<G>
for (const getterName in getters) {
+ // @ts-ignore: it's only readonly for the users
computedGetters[getterName] = computed(() => {
setActivePinia(pinia)
// eslint-disable-next-line @typescript-eslint/no-use-before-define
* @internal
*/
export type StoreWithGetters<G> = {
- [k in keyof G]: G[k] extends (this: infer This, store?: any) => infer R
+ readonly [k in keyof G]: G[k] extends (
+ this: infer This,
+ store?: any
+ ) => infer R
? R
: never
}