createCommand
API reference for createCommand
Function: createCommand()
Section titled “Function: createCommand()”createCommand<
CommandType
,CommandData
>(type
,data
,metadata?
):Command
<CommandType
,CommandData
,undefined
|DefaultRecord
>
Simple command creation with automatic type inference
Type Parameters
Section titled “Type Parameters”CommandType
Section titled “CommandType”CommandType
extends string
CommandData
Section titled “CommandData”CommandData
extends DefaultRecord
Parameters
Section titled “Parameters”CommandType
The command type identifier
CommandData
The command payload data
metadata?
Section titled “metadata?”Optional command metadata
Returns
Section titled “Returns”Command
<CommandType
, CommandData
, undefined
| DefaultRecord
>
A properly typed command instance
Example
Section titled “Example”const registerUser = createCommand('RegisterUser', { userId: 'user-123', email: 'user@example.com'});