I installed mxgraph and @typed-mxgraph/typed-mxgraph typings from npm. Save the typings to dev dependencies and then added the typings to typeRoots in tsconfig.json as mentioned on the page https://www.npmjs.com/package/@typed-mxgraph/typed-mxgraph.
Then I used the code snippet mentioned below
import factory from 'mxgraph';
const mx = factory({
mxBasePath: '',
});
console.log(mx.mxClient.VERSION);
But I am getting the error "Uncaught TypeError: Cannot set property 'mxBasePath' of undefined" in the browser.
I also followed Benjamin's answer mxGraph and it's Types integration with angular 8 here and can use the methods by using declare but the mxBasePath error still persists.
So if anyone has a solution please share. Thanks a lot.