@@ -25,17 +25,6 @@ export interface StoreOptions {
2525 readonly __useConciseStateMode__ ?: boolean ;
2626}
2727
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-
3928/**
4029 * @description Type of storeMapValue
4130 */
@@ -55,6 +44,31 @@ export type StoreMapValueType<S extends PrimitiveState> = {
5544 updater : Callback ;
5645} ;
5746
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+
5872export type StoreMapValue < S extends PrimitiveState > = MapType < StoreMapValueType < S > > ;
5973// Type of storeMap
6074export type StoreMap < S extends PrimitiveState > = Map < keyof S , StoreMapValue < S > > ;
@@ -182,30 +196,8 @@ export interface UseSubscription<S extends PrimitiveState> {
182196 useSubscription ( listener : ListenerType < S > , stateKeys ?: ( keyof S ) [ ] ) : void ;
183197}
184198
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" ;
209201
210202/** thisType type used to initialize store when initialState is a function */
211203export type InitialStore < S extends PrimitiveState > = {
0 commit comments