@@ -125,20 +125,28 @@ export type ResolveState<State extends object> = {
125125 : State [ P ] extends object ? ResolveState < State [ P ] > : State [ P ]
126126}
127127
128- type TFirstArg < T > = T extends ( ) => any
129- ? never
130- : T extends ( a1 : infer TResult ) => any ? TResult : never
128+ type TActionValue < T > = T extends ( a1 : infer TContext ) => any
129+ ? ( TContext extends { value : infer TValue } ? TValue : never )
130+ : never
131+
132+ type TOperationValue < T > = T extends (
133+ arg1 : any ,
134+ arg2 : infer TContext ,
135+ arg3 : any
136+ ) => any
137+ ? ( TContext extends { value : infer TValue } ? TValue : never )
138+ : never
131139
132140type NestedActions = { [ key : string ] : TAction < any , any > | NestedActions }
133141
134142export type ResolveActions < Actions extends NestedActions > = {
135143 [ T in keyof Actions ] : Actions [ T ] extends TAction < any , any >
136- ? [ TFirstArg < Actions [ T ] > [ 'value' ] ] extends [ void ]
144+ ? [ TActionValue < Actions [ T ] > ] extends [ void ]
137145 ? ( ) => ReturnType < Actions [ T ] >
138- : ( value : TFirstArg < Actions [ T ] > [ 'value' ] ) => ReturnType < Actions [ T ] >
146+ : ( value : TActionValue < Actions [ T ] > ) => ReturnType < Actions [ T ] >
139147 : Actions [ T ] extends TOperator < any , any >
140- ? [ TFirstArg < Actions [ T ] > [ 'value' ] ] extends [ void ]
148+ ? [ TOperationValue < Actions [ T ] > ] extends [ void ]
141149 ? ( ) => ReturnType < Actions [ T ] >
142- : ( value : TFirstArg < Actions [ T ] > [ 'value' ] ) => ReturnType < Actions [ T ] >
150+ : ( value : TOperationValue < Actions [ T ] > ) => ReturnType < Actions [ T ] >
143151 : Actions [ T ] extends NestedActions ? ResolveActions < Actions [ T ] > : never
144152}
0 commit comments