Problem with gojs and typescript


when porting a working example from JS to TS, I get an error: property ‘key’ does not exist on type object.

the line has not changed from JS to TS, and all the rest is working perfectly.

the line is :

any ideas?

I’m not entirely sure why you’d be getting that error, but based on what you’ve written, it seems you could simplify your code to myDiagram.model.nodeDataArray[i] since you seem to already have its index. You don’t need to call findNodeDataForKey.

works perfectly

if were at it already,
I get an error that my property (named ‘nadeLevel’ if that matters) does not exist on type object.
the object is myDiagram.model.nodeDataArray[i]

but when I put a break point on the line before, I see it’s there.
I guess it’s something related to the type of object? but how do I get round it?
again = this works perfectly in JS but not in TS

Cast it as any


takes time to grasp the TS syntax