Skip to content

Commit 292350f

Browse files
committed
chore: note
[skip ci]
1 parent ecc7449 commit 292350f

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

packages/pinia/src/storeToRefs.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ type _ToStateRefs<SS> =
6868
* Extracts the return type for `storeToRefs`.
6969
* Will convert any `getters` into `ComputedRef`.
7070
*/
71-
export type StoreToRefs<SS extends StoreGeneric> = SS extends unknown
72-
? _ToStateRefs<SS> &
73-
ToRefs<PiniaCustomStateProperties<StoreState<SS>>> &
74-
_ToComputedRefs<StoreGetters<SS>>
75-
: never
71+
export type StoreToRefs<SS extends StoreGeneric> =
72+
// NOTE: always trues but the conditional makes the type distributive
73+
// https://www.typescriptlang.org/docs/handbook/2/conditional-types.html#distributive-conditional-types
74+
SS extends unknown
75+
? _ToStateRefs<SS> &
76+
ToRefs<PiniaCustomStateProperties<StoreState<SS>>> &
77+
_ToComputedRefs<StoreGetters<SS>>
78+
: never
7679

7780
/**
7881
* Creates an object of references with all the state, getters, and plugin-added

0 commit comments

Comments
 (0)