‘startTransaction’ does not exist

Hi,

I’m sure I’m missing something dumb. But for the love of me, I havent been able to figure it out.

I am using the latest goJS (after a surprisingly uneventful migration from 1.7 to 2.15) and our overly friendly typescript complains about the following:

Property ‘startTransaction’ does not exist on type ‘typeof Diagram’.

So I go and recheck the docs, and this has not gone anywhere, its still there, yet TS inisists otherwise.
My code looks like this:

import * as go from 'gojs/release/go-module';
export const Helper = {
  diagram: go.Diagram,

  /**
   * Starts a Transaction and returns he TxID
   */
  beginTransaction: function (msg: string, baseName = '') {
    if (!Helper.diagram) throw new Error('no diagram found');
    let id = `${baseName}-${this.randomString()}`;
    Helper.diagram.startTransaction(id);
    console.group(`👉 ${id} :: Begin Transaction ${msg}`);
    return id;
  },
//...
}

Where is ‘gojs/release/go-module’ ? Maybe it’s not finding that go-module.d.tsfile.

I’m wondering if you need to use a relative path.

It’s in node_modules. I mean I just got it from npm (“gojs”: “~2.1.15”)

There, as I said it was a dumb mistake. I just was just using a go.Diagram as a var instead of a type.
the diagram: go.Diagram should read diagram: undefined as go.Diagram|undefined. yeah, the shame is unbearable

Hey, I didn’t catch it either – I thought it was a type (object shape) declaration.