@@ -38,7 +38,7 @@ interface Global {
3838type ClassSetter = React . Dispatch < any > | undefined
3939
4040// Very Sad, Promise<ProduceFunc<S>> can not work with Partial<S> | ProduceFunc<S>
41- type Action < S = { } , P = any , ActionKeys = { } , ExtContext = { } > = (
41+ type Action < S = { } , P = any , ActionKeys = { } , ExtContext extends { } = { } > = (
4242 params : P ,
4343 context : {
4444 state : S
@@ -55,7 +55,7 @@ type Action<S = {}, P = any, ActionKeys = {}, ExtContext = {}> = (
5555type ProduceFunc < S > = ( state : S ) => void
5656
5757// v3.0 Actions
58- type Actions < S = { } , ActionKeys = { } , ExtContext = { } > = {
58+ type Actions < S = { } , ActionKeys = { } , ExtContext extends object = { } > = {
5959 [ P in keyof ActionKeys ] : Action < S , ActionKeys [ P ] , ActionKeys , ExtContext >
6060}
6161
@@ -94,13 +94,13 @@ type Context<S = {}> = (InnerContext<S>) & {
9494
9595type Middleware < S = { } > = ( C : Context < S > , M : Middleware < S > [ ] ) => void
9696
97- interface Models < State = any , ActionKeys = any > {
97+ interface Models < State = any , ActionKeys = any , ExtContext extends { } = { } > {
9898 [ name : string ] :
99- | ModelType < State , ActionKeys >
100- | API < ModelType < State , ActionKeys > >
99+ | ModelType < State , ActionKeys , ExtContext >
100+ | API < ModelType < State , ActionKeys , { } > >
101101}
102102
103- interface API < MT extends ModelType = any > {
103+ interface API < MT extends ModelType = ModelType < any , any , { } > > {
104104 __id : string
105105 useStore : (
106106 depActions ?: Array < keyof MT [ 'actions' ] >
@@ -162,7 +162,11 @@ interface APIs<M extends Models> {
162162}
163163
164164// v3.0
165- type ModelType < InitStateType = any , ActionKeys = any , ExtContext = { } > = {
165+ type ModelType <
166+ InitStateType = any ,
167+ ActionKeys = any ,
168+ ExtContext extends { } = { }
169+ > = {
166170 actions : {
167171 [ P in keyof ActionKeys ] : Action <
168172 InitStateType ,
0 commit comments