Using DrawCommandHandler in go.Diagram


I need to move my objects in diagram with arrow keys so I’ve tried to use DrawCommandHandler after importing the extension but it seems like my diagram does not allow me to use another type than CommandHandler for this property

const  diagram  =  this.$(go.Diagram,  container,  {
commandHandler:  this.$(DrawCommandHandler),
diagram.commandHandler.arrowKeyBehavior  =  'move';

If I create the commandHandler with go.GraphObject.make(), there is an error telling me that arrowKeyBehavoir does not exist and if I use new DrawCommandHandler() it compiles but I have an unreadable error in the browser and the diagram does not appear

I’m running gojs v2.1.56 and angular v12.2.14

I assume you’re using TypeScript, and that it’s the TypeScript compiler that isn’t letting you use an instance of DragCommandHandler as the Diagram.commandHandler. It is not the Diagram that is preventing it.
Does the code run correctly?

If you want to use TypeScript, copy the *.ts file from the extensionsJSM directory into your project, and fix its import statement to suit your environment. Then the type of DrawCommandHandler should be known as a subclass of CommandHandler to the TypeScript compiler.

In fact I was using DrawCommandHandler class from my node_modules directory and not directly in my app, duplicating the file into my app and resolving some lint errors solved the issue

Thanks a lot !