mxGraph Typescript Declarations For Official mxGraph NPM Package.
-
Add
mxgraph
and@typed-mxgraph/typed-mxgraph
dependencies 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.json
appendnode_modules/@typed-mxgraph
totypeRoots
:{ "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);