Argument of type '() => any' is not assignable to parameter of type 'ConstructorType<() => any>'

Hello!

I am trying to follow the https://gojs.net/latest/samples/parseTree.html
example for creating a custom layout but my diagram wont take the custom layout and it throws the error “Argument of type ‘() => any’ is not assignable to parameter of type ‘ConstructorType<() => any>’.”

The line that throws this error is when trying to set layout as flatTreeLayout.

const myDiagram =
    $(go.Diagram, "myDiagramDiv",
      {
        allowCopy: false,
        allowDelete: false,
        allowMove: false,
        initialAutoScale: go.Diagram.Uniform,
        layout:
          $(FlatTreeLayout,  // custom Layout, defined below
            {
              angle: 90,
              compaction: go.TreeLayout.CompactionNone
            }),
        "undoManager.isEnabled": true
      });

I have FlatTreeLayout defined below but it states

Argument of type '() => any' is not assignable to parameter of type 'ConstructorType<() => any>'.
Type '() => any' provides no match for the signature 'new (...args: any[]): any'.

I am also using Angular 2 and the latest version of gojs.
I haven’t had any trouble with any other layouts until I tried defining a custom layout

How do you define FlatTreeLayout? Don’t bother showing any of its methods.

I figured it out its supposed to be

layout: new FlatTreeLayout()

for angular users.