Skip to content

Type Alias: CommandExecutor

ts
type CommandExecutor = <R, D, T>(type: T, data?: D) => CommandDescriptor<R>;

Defined in: src/wirestate-react/types/commands.ts:23

Represents the function returned by useCommandExecutor.

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

CommandDescriptor<R>

A descriptor containing the execution task and status.

Remarks

Typically returned by useCommandExecutor. Dispatched commands are automatically wrapped in a CommandDescriptor.