Using GoJS 2.0.3 and Typescript 2.9.2 facing issue in go.List


  error TS2345: Argument of type 'typeof Point' is not assignable to parameter of type 'Iterable<{}> | {}[]'.
      Type 'typeof Point' is not assignable to type '{}[]'.
        Property 'includes' is missing in type 'typeof Point'.

new go.List(go.Point).addAll([new go.Point(0, 0), new go.Point(90, 0)]),

The change log lists several small incompatibilities that are in version 2.0. One of them is how we are getting ready, in a future major version, to use the ES6 Set and Map classes.

The GoJS List, Set, and Map constructors no longer take type arguments and no longer do type checking in JavaScript. However, when using TypeScript these classes are now generic and will do type checking at compile time.

In JavaScript, instead of new go.List(go.Point), write new go.List(). For compatibility, you can still provide an element type argument, but it is not used and not checked.

In TypeScript, instead of new go.List(go.Point), write new go.List<go.Point>(), and the TypeScript compiler will enforce the List element typing.

All three constructors now take an optional Iterable or Array argument that provides the initial elements for the new collection.

In a future major version, we may replace go.Map and go.Set with enhanced ES6 Map and Set classes.

Alas, I do not know how to improve the tsc error messages, which can be mysterious.

FYI, we implemented our own go.Set and go.Map classes before the modern Set and Map classes were proposed. Fortunately, they are quite similar, so now in V2 you can treat them as basically the same, except for iteration.