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;
},
//...
}