Skip to content

Commit 32ab1fe

Browse files
feat(ResultHandler): add type that represents function to handle the result of the ResultCallback function before its result returns with optional payload.
1 parent 86d17fc commit 32ab1fe

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/type/result-handler.type.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
/**
2-
* Function to handle the result of the `ResultCallback` function before its result returns.
2+
* Function to handle the result of the `ResultCallback` function before its result returns with optional payload.
33
*/
4-
export type ResultHandler = (result: boolean, value: any) => void;
4+
export type ResultHandler<Payload extends object = any> = (
5+
// Result of the callback.
6+
result: boolean,
7+
8+
// An optional object to provide more data.
9+
payload?: Payload
10+
) => void;

0 commit comments

Comments
 (0)