Some issues when shifting to 2.0

Hey

some issues after shifting to version 2:
nodeData.group tells me now that “property ‘group’ does not exist on type ‘object’”
same for button.click - “click does not exist on type {}”
and new go.Map(“string”, go.Node) - “expected 0-1 arguments but got 2”

for the first one i tried (nodeData as go.Diagram.nodeData).group but that gives an error too

any ideas?

also, we are extending the portshiftingtool, and now I get this error:
“property ‘port’ is private and only accessible within class ‘PortShiftingTool’”

and last one, when trying to use an HTML context menu, we use nodeTemplate.contextMenu = …
and the error is “Type HTMLElement’ is not assignable to type ‘Adornment | HTMLInfo’. Type 'HTMLElement is not assignable to type ‘HTMLInfo’. property ‘mainElement’ is missing in type ‘HTMLElement’”

Yes, regarding your first point: In version 2 the List, Set and Map constructors no longer take type arguments. This is clearly documented in the release notes: GoJS Change Log.

This is to prepare us for future compatibility with ES6 Set and Map.

And regarding your last point: In version 2 one can no longer use an HTMLElement instead of an Adornment or an HTMLInfo. This is clearly documented in the release notes: GoJS Change Log.

HTMLInfo was introduced in version 1.7: GoJS HTML Interaction -- Northwoods Software

thanks, will try that,

what about these:

and

I don’t know why the port property changed from public to private in the PortShiftingTool extensionsTS class. We’ll make it public again. You can do that yourself in your copy for now.

I don’t have any idea what you are talking about for the other cases – you need to debug those yourself.

thanks

regarding the type problems, I guess i need something like this: " (nodeData as go.Diagram.nodeData).group"
the question is which types should I use for nodeData and button?
“go.Diagram.nodeData” gives an error for nodeData so I guess it’s no the correct one.

Try any. It seems that these problems have nothing to do with upgrading to version 2 of GoJS, but with using TypeScript.

will try, but it works perfect with 1.8.36 and fails with 2.0

One change with version 2 is that the go.d.ts file is now automatically generated from the sources, whereas it had been manually written before.