Sign up (with export icon)

CommandsMap

Api-interface icon interface

Helper type that maps command names to their types. It is meant to be extended with module augmentation.

class MyCommand extends Command {
	public execute( parameter: A ): B {
		// ...
	}
}

declare module '@ckeditor/ckeditor5-core' {
	interface CommandsMap {
		myCommand: MyCommand;
	}
}

// Returns `MyCommand | undefined`.
const myCommand = editor.commands.get( 'myCommand' );

// Expects `A` type as parameter and returns `B`.
const value = editor.commands.execute( 'myCommand', new A() );
Copy code

Properties