@@ -32,7 +32,7 @@ export function isPlainObject(
32
32
*
33
33
* @internal
34
34
*/
35
- export type DeepPartial < T > = { [ K in keyof T ] ?: DeepPartial < T [ K ] > }
35
+ export type _DeepPartial < T > = { [ K in keyof T ] ?: _DeepPartial < T [ K ] > }
36
36
// type DeepReadonly<T> = { readonly [P in keyof T]: DeepReadonly<T[P]> }
37
37
38
38
// TODO: can we change these to numbers?
@@ -112,7 +112,7 @@ export interface SubscriptionCallbackMutationPatchObject<S>
112
112
/**
113
113
* Object passed to `store.$patch()`.
114
114
*/
115
- payload : DeepPartial < S >
115
+ payload : _DeepPartial < S >
116
116
}
117
117
118
118
/**
@@ -142,8 +142,6 @@ export type SubscriptionCallbackMutation<S> =
142
142
| SubscriptionCallbackMutationPatchObject < S >
143
143
| SubscriptionCallbackMutationPatchFunction
144
144
145
- export type UnwrapPromise < T > = T extends Promise < infer V > ? V : T
146
-
147
145
/**
148
146
* Callback of a subscription
149
147
*/
@@ -164,8 +162,13 @@ export type SubscriptionCallback<S> = (
164
162
/**
165
163
* Actual type for {@link StoreOnActionListenerContext}. Exists for refactoring
166
164
* purposes. For internal use only.
165
+ * @internal
167
166
*/
168
- interface _StoreOnActionListenerContext < Store , ActionName extends string , A > {
167
+ export interface _StoreOnActionListenerContext <
168
+ Store ,
169
+ ActionName extends string ,
170
+ A
171
+ > {
169
172
/**
170
173
* Name of the action
171
174
*/
@@ -191,12 +194,12 @@ interface _StoreOnActionListenerContext<Store, ActionName extends string, A> {
191
194
after : (
192
195
callback : A extends Record < ActionName , _Method >
193
196
? (
194
- resolvedReturn : UnwrapPromise < ReturnType < A [ ActionName ] > >
197
+ resolvedReturn : Awaited < ReturnType < A [ ActionName ] > >
195
198
// allow the after callback to override the return value
196
199
) =>
197
200
| void
198
201
| ReturnType < A [ ActionName ] >
199
- | UnwrapPromise < ReturnType < A [ ActionName ] > >
202
+ | Awaited < ReturnType < A [ ActionName ] > >
200
203
: ( ) => void
201
204
) => void
202
205
@@ -328,7 +331,7 @@ export interface _StoreWithState<
328
331
*
329
332
* @param partialState - patch to apply to the state
330
333
*/
331
- $patch ( partialState : DeepPartial < UnwrapRef < S > > ) : void
334
+ $patch ( partialState : _DeepPartial < UnwrapRef < S > > ) : void
332
335
333
336
/**
334
337
* Group multiple changes into one function. Useful when mutating objects like
@@ -544,30 +547,34 @@ export type _GettersTree<S extends StateTree> = Record<
544
547
export type _ActionsTree = Record < string , _Method >
545
548
546
549
/**
550
+ * Type that enables refactoring through IDE.
547
551
* @internal
548
552
*/
549
- type _ExtractStateFromSetupStore_Keys < SS > = keyof {
553
+ export type _ExtractStateFromSetupStore_Keys < SS > = keyof {
550
554
[ K in keyof SS as SS [ K ] extends _Method | ComputedRef ? never : K ] : any
551
555
}
552
556
553
557
/**
558
+ * Type that enables refactoring through IDE.
554
559
* @internal
555
560
*/
556
- type _ExtractActionsFromSetupStore_Keys < SS > = keyof {
561
+ export type _ExtractActionsFromSetupStore_Keys < SS > = keyof {
557
562
[ K in keyof SS as SS [ K ] extends _Method ? K : never ] : any
558
563
}
559
564
560
565
/**
566
+ * Type that enables refactoring through IDE.
561
567
* @internal
562
568
*/
563
- type _ExtractGettersFromSetupStore_Keys < SS > = keyof {
569
+ export type _ExtractGettersFromSetupStore_Keys < SS > = keyof {
564
570
[ K in keyof SS as SS [ K ] extends ComputedRef ? K : never ] : any
565
571
}
566
572
567
573
/**
574
+ * Type that enables refactoring through IDE.
568
575
* @internal
569
576
*/
570
- type _UnwrapAll < SS > = { [ K in keyof SS ] : UnwrapRef < SS [ K ] > }
577
+ export type _UnwrapAll < SS > = { [ K in keyof SS ] : UnwrapRef < SS [ K ] > }
571
578
572
579
/**
573
580
* @internal
0 commit comments