Skip to content

Commit

Permalink
fix(types): fix storeToRefs state return type
Browse files Browse the repository at this point in the history
Fix #2574

Remove the internal notation that broke tests
  • Loading branch information
posva committed Apr 16, 2024
1 parent 48a2ca3 commit b227a40
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions packages/pinia/src/storeToRefs.ts
Expand Up @@ -29,10 +29,9 @@ type ToComputedRefs<T> = {

/**
* 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<SS> =
type _ToStateRefs<SS> =
SS extends Store<
string,
infer UnwrappedState,
Expand All @@ -50,7 +49,7 @@ type ToStateRefs<SS> =
* Extracts the return type for `storeToRefs`.
* Will convert any `getters` into `ComputedRef`.
*/
export type StoreToRefs<SS extends StoreGeneric> = ToStateRefs<SS> &
export type StoreToRefs<SS extends StoreGeneric> = _ToStateRefs<SS> &
ToRefs<PiniaCustomStateProperties<StoreState<SS>>> &
ToComputedRefs<StoreGetters<SS>>

Expand Down

0 comments on commit b227a40

Please sign in to comment.