CommandPayloadType
typeType helper for extracting the payload type from a command.
Import
import { CommandPayloadType } from '@modular/sdk/editor';Notes
- example
- ```ts const MY_COMMAND = createCommand<SomeType>(); // ... editor.registerCommand(MY_COMMAND, payload => { // Type of `payload` is inferred here. But lets say we want to extract a function to delegate to $handleMyCommand(editor, payload); return true; }); function $handleMyCommand(editor: LexicalEditor, payload: CommandPayloadType<typeof MY_COMMAND>) { // `payload` is of type `SomeType`, extracted from the command. } ```