mxGraph Typescript Declarations For Official mxGraph NPM Package.
-
Add
mxgraphand@typed-mxgraph/typed-mxgraphdependencies to your project:npm:
npm install --save mxgraph npm install --save-dev @typed-mxgraph/typed-mxgraph
yarn:
yarn add mxgraph yarn add --dev @typed-mxgraph/typed-mxgraph
-
Update
tsconfig.jsonappendnode_modules/@typed-mxgraphtotypeRoots:{ "compilerOptions": { "target": "es5", "module": "commonjs", "esModuleInterop": true, "typeRoots": [ "node_modules/@types", "node_modules/@typed-mxgraph" ] } } -
Import mxGraph factory:
import factory from 'mxgraph'; const mx = factory({ mxBasePath: '', }); console.log(mx.mxClient.VERSION);