@@ -25,17 +25,6 @@ export interface StoreOptions {
25
25
readonly __useConciseStateMode__ ?: boolean ;
26
26
}
27
27
28
- /** Type of key disabled in the initialization parameters */
29
- export type InitialStateForbiddenKeys =
30
- | "setState"
31
- | "syncUpdate"
32
- | "subscribe"
33
- | "restore"
34
- | "setOptions"
35
- | "useStore"
36
- | "useSubscription"
37
- | "store" ;
38
-
39
28
/**
40
29
* @description Type of storeMapValue
41
30
*/
@@ -55,6 +44,31 @@ export type StoreMapValueType<S extends PrimitiveState> = {
55
44
updater : Callback ;
56
45
} ;
57
46
47
+ /** Some of the core tool method types of store */
48
+ export type StoreCoreUtils < S extends PrimitiveState > = Readonly <
49
+ & SetState < S >
50
+ & SyncUpdate < S >
51
+ & Restore < S >
52
+ & Subscribe < S >
53
+ & UseStore < S >
54
+ & UseSubscription < S >
55
+ > ;
56
+
57
+ /** Tool method type of store */
58
+ export type StoreUtils < S extends PrimitiveState > = StoreCoreUtils < S > & Readonly < SetOptions > ;
59
+
60
+ /** The type of store returned by createStore */
61
+ export type Store < S extends PrimitiveState > = S & StoreUtils < S > ;
62
+
63
+ export type ConciseStoreCore < S extends PrimitiveState > = S & StoreCoreUtils < S > ;
64
+
65
+ export interface ConciseStoreHeart < S extends PrimitiveState > {
66
+ readonly store : ConciseStoreCore < S > ;
67
+ }
68
+
69
+ /** Return type of useConciseState */
70
+ export type ConciseStore < S extends PrimitiveState > = S & StoreCoreUtils < S > & ConciseStoreHeart < S > ;
71
+
58
72
export type StoreMapValue < S extends PrimitiveState > = MapType < StoreMapValueType < S > > ;
59
73
// Type of storeMap
60
74
export type StoreMap < S extends PrimitiveState > = Map < keyof S , StoreMapValue < S > > ;
@@ -182,30 +196,8 @@ export interface UseSubscription<S extends PrimitiveState> {
182
196
useSubscription ( listener : ListenerType < S > , stateKeys ?: ( keyof S ) [ ] ) : void ;
183
197
}
184
198
185
- /** Some of the core tool method types of store */
186
- export type StoreCoreUtils < S extends PrimitiveState > = Readonly <
187
- & SetState < S >
188
- & SyncUpdate < S >
189
- & Restore < S >
190
- & Subscribe < S >
191
- & UseStore < S >
192
- & UseSubscription < S >
193
- > ;
194
-
195
- /** Tool method type of store */
196
- export type StoreUtils < S extends PrimitiveState > = StoreCoreUtils < S > & Readonly < SetOptions > ;
197
-
198
- /** The type of store returned by createStore */
199
- export type Store < S extends PrimitiveState > = S & StoreUtils < S > ;
200
-
201
- export type ConciseStoreCore < S extends PrimitiveState > = S & StoreCoreUtils < S > ;
202
-
203
- export interface ConciseStoreHeart < S extends PrimitiveState > {
204
- readonly store : ConciseStoreCore < S > ;
205
- }
206
-
207
- /** Return type of useConciseState */
208
- export type ConciseStore < S extends PrimitiveState > = S & StoreCoreUtils < S > & ConciseStoreHeart < S > ;
199
+ /** Type of key disabled in the initialization parameters */
200
+ export type InitialStateForbiddenKeys = keyof StoreUtils < PrimitiveState > | "store" ;
209
201
210
202
/** thisType type used to initialize store when initialState is a function */
211
203
export type InitialStore < S extends PrimitiveState > = {
0 commit comments