File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -19,10 +19,10 @@ import {isDefined} from 'gmp/utils/identity';
19
19
* @throws {* } - The error from the rejected promise if onError callback is not provided.
20
20
*/
21
21
22
- const actionFunction = async < ResponseType , ReturnType > (
22
+ const actionFunction = async < ResponseType , ReturnType , ErrorType = unknown > (
23
23
promise : Promise < ResponseType > ,
24
24
onSuccess ?: ( response : ResponseType ) => ReturnType ,
25
- onError ?: ( error : unknown ) => ReturnType ,
25
+ onError ?: ( error : ErrorType ) => ReturnType ,
26
26
successMessage ?: string ,
27
27
) : Promise < ReturnType | ResponseType > => {
28
28
try {
@@ -36,7 +36,7 @@ const actionFunction = async <ResponseType, ReturnType>(
36
36
return response ;
37
37
} catch ( error ) {
38
38
if ( isDefined ( onError ) ) {
39
- return onError ( error ) ;
39
+ return onError ( error as ErrorType ) ;
40
40
}
41
41
throw error ;
42
42
}
You can’t perform that action at this time.
0 commit comments