From b227a40b2e4d6e43611d3b84d973e5a97e22caa1 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Tue, 16 Apr 2024 17:58:32 +0200 Subject: [PATCH] fix(types): fix storeToRefs state return type Fix #2574 Remove the internal notation that broke tests --- packages/pinia/src/storeToRefs.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/pinia/src/storeToRefs.ts b/packages/pinia/src/storeToRefs.ts index a6b91217e2..c56ff6a83e 100644 --- a/packages/pinia/src/storeToRefs.ts +++ b/packages/pinia/src/storeToRefs.ts @@ -29,10 +29,9 @@ type ToComputedRefs = { /** * Extracts the refs of a state object from a store. If the state value is a Ref or type that extends ref, it will be kept as is. - * Otherwise, it will be converted into a Ref. - * @internal + * Otherwise, it will be converted into a Ref. **Internal type DO NOT USE**. */ -type ToStateRefs = +type _ToStateRefs = SS extends Store< string, infer UnwrappedState, @@ -50,7 +49,7 @@ type ToStateRefs = * Extracts the return type for `storeToRefs`. * Will convert any `getters` into `ComputedRef`. */ -export type StoreToRefs = ToStateRefs & +export type StoreToRefs = _ToStateRefs & ToRefs>> & ToComputedRefs>