Error when upgrading to gojs-angular 2.0

I’m trying to upgrade my application to use the gojs-angular wrapper 2.0. I followed the walk-through guide and I’m using immer lib.

However I get the following compilation error

When I run the sample provided by go-js, I don’t get this error and it works just fine. But I can’t understand why. It should break like in my application because the error seems legit.

Or do I need to set some typescript config so taht it ignores the error ?

So you declared your diagramNodeData to be a specific type. I guess you just need to cast what is generally declared as ObjectData[] to what you have declared.

I have not. I have followed the sample and it is declared like this :

  public state = {
    // new diagram should have a default Start node
    diagramNodeData: [

        key: 'StartNode', color1: 'white', color2: 'green', figure: 'Ellipse', label: 'Start', location: '-460 -170',
        desiredSize: '120 60',
        stepDefinitionCode: ''

casting it to this type would make no sense as it is such a weird type with many properties. I have casted it to ‘any’ just to avoid the compilation error.

The question is, why don’t we have this error in the gojs-angular-basic sample ? Is there something I should configure ? I don’t want to start casting as ‘any’, especially since with the new immutable approach, I’ll have to do it in many places.

Your compilation error message seems to indicate that you did declare it to be of type:
WritableDraft<{ id: string, text: string, color: string }>[]

it does. But I have pasted the code above and as you can see, I did not set it to that type.

It is the EXACT same code as the gojs-angular-basic sample. So there must be something configured in the sample so that it does not produce compilation error and I’d like to know what.

Some more advanced angular sample would also be appreciated because it is very basic one. Migrating to version 2.0 is driving me crazy, I have so many issues and right now my application is not working at all. I’ll open more tickets for other related issues

Maybe it’s not worth upgrading to gojs-angular 2.0.

The new version is basically a different design, with immutable data, and that might just not be of value to you.

if I don’t upgrade now, I’ll run into issues later. You aren’t going to maintain version 1 forever I suppose ?

We only intend to apply bug fixes to gojs-angular 1.*. So you don’t need to worry about incompatible changes to it.

If you run into problems later, we can help you then.