Type Alias: ExtractHookHandlerArgs<Handler>
ts
type ExtractHookHandlerArgs<Handler> =
Handler extends HookHandler<infer A, infer B> ? [A, B] : never;Utility type to extract argument types from a hook handler.
Extracts both the hook handler arguments and cleanup handler arguments from a HookHandler type.
Type Parameters
| Type Parameter | Description |
|---|---|
Handler | The hook handler type to extract arguments from |
Returns
A tuple containing [HookArgs, CleanupArgs]
Example
ts
type MyHandler = HookHandler<[User, Transaction], [Error | null, User]>;
type Args = ExtractHookHandlerArgs<MyHandler>;
// Args = [[User, Transaction], [Error | null, User]]