I recently moved a project from JS to TS.
We used to use RealtimeDragSelectingTool
as schema.toolManager.dragSelectingTool
by importing gojs/extensions/RealtimeDragSelectingTool
.
I saw that there is two import methods while working on typescript by using extensionsJSM
or extensionsTS
.
First I imported extensionsTS
but got the same error as this stack overflow question, who in fact did not have a clear answer.
So I imported extensionsJSM
, it is working but I have that error comming up in my IDE
Type 'RealtimeDragSelectingTool' is not assignable to type 'DragSelectingTool'.
Types of property 'box' are incompatible.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Part | null' is not assignable to type 'go.Part | null'.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Part' is not assignable to type 'go.Part'.
The types returned by 'adornments.first()' are incompatible between these types.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Adornment | null' is not assignable to type 'go.Adornment | null'.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Adornment' is not assignable to type 'go.Adornment'.
Types of property 'placeholder' are incompatible.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Placeholder | null' is not assignable to type 'go.Placeholder | null'.
Type 'import("c:/Dev/gojs-project/node_modules/gojs/release/go-module").Placeholder' is not assignable to type 'go.Placeholder'.
Property 'computeBorder' is protected but type 'Placeholder' is not a class derived from 'Placeholder'.ts(2322)
Simply copy the extension file to your project and import it, it works fine RTFM...