From 67ddc04453e8fcc6d6eded47b37128fe938a1ce5 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Wed, 9 Oct 2024 11:43:37 +0200 Subject: [PATCH] docs: match vitest mock Close #2759, #2796 --- packages/docs/cookbook/testing.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/docs/cookbook/testing.md b/packages/docs/cookbook/testing.md index b7bc381a..657ae7b4 100644 --- a/packages/docs/cookbook/testing.md +++ b/packages/docs/cookbook/testing.md @@ -172,6 +172,7 @@ Actions are automatically spied but type-wise, they are still the regular action ```ts import type { Mock } from 'vitest' +import type { UnwrapRef } from 'vue' import type { Store, StoreDefinition } from 'pinia' function mockedStore unknown>( @@ -187,15 +188,13 @@ function mockedStore unknown>( State, Record, { - [K in keyof Actions]: Actions[K] extends ( - ...args: infer Args - ) => infer ReturnT + [K in keyof Actions]: Actions[K] extends (...args: any[]) => any ? // 👇 depends on your testing framework - Mock + Mock : Actions[K] } > & { - [K in keyof Getters]: Getters[K] extends ComputedRef ? T : never + [K in keyof Getters]: UnwrapRef } : ReturnType { return useStore() as any -- 2.47.3