FindObject not available

I was trying to follow the example of using an OrgChartEditor and when I try to call findObject on a go.GraphObject, the function is not on that object.

Here is an example

import * as go from ‘gojs’

mouseDragEnter: function (e, node:go.GraphObject, prev) {
const diagram = node.diagram;
const selectedNode = diagram.selection.first();
const shape = node.findObject(“SHAPE”)

The error message says: Property findObject does not exist on GraphObject

I thought node was suppose to be a graph object ? Should I cast it to any instead ?

findObject is defined on Panel: Panel | GoJS API.
So, yes, you’ll need to cast it.

        mouseDragEnter: function(e: go.InputEvent, node: go.GraphObject, prev: go.GraphObject) {
          . . . (node as go.Node).findObject("SHAPE");

By the way, it would have been nice to make it clear that it was a compile-time TypeScript error, not a run-time error, that was bothering you. If you had compiled the code and run it, despite the compiler error, it would have worked correctly.