Type Alias: OptionalCommandExecutor
ts
type OptionalCommandExecutor = <R, D, T>(type: T, data?: D) => Optional<CommandDescriptor<R>>;Defined in: src/wirestate-react/types/commands.ts:46
Represents the function returned by useOptionalCommandExecutor.
Type Parameters
| Type Parameter | Default type | Description |
|---|---|---|
R | unknown | The expected result type of the command task. |
D | unknown | The type of the data payload. |
T extends CommandType | CommandType | The command identifier type. |
Parameters
| Parameter | Type | Description |
|---|---|---|
type | T | The command identifier. |
data? | D | Optional payload for the command. |
Returns
Optional<CommandDescriptor<R>>
A descriptor if a handler was found, or null otherwise.
Remarks
Typically returned by useOptionalCommandExecutor. Returns null if no handler is registered for the command type, instead of throwing.