Skip to content

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 ParameterDefault typeDescription
RunknownThe expected result type of the command task.
DunknownThe type of the data payload.
T extends CommandTypeCommandTypeThe command identifier type.

Parameters

ParameterTypeDescription
typeTThe command identifier.
data?DOptional 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.