Skip to content

createCommand

API reference for createCommand

@delta-base/toolkit


createCommand<CommandType, CommandData>(type, data, metadata?): Command<CommandType, CommandData, undefined | DefaultRecord>

Simple command creation with automatic type inference

CommandType extends string

CommandData extends DefaultRecord

CommandType

The command type identifier

CommandData

The command payload data

DefaultRecord

Optional command metadata

Command<CommandType, CommandData, undefined | DefaultRecord>

A properly typed command instance

const registerUser = createCommand('RegisterUser', {
userId: 'user-123',
email: 'user@example.com'
});