Is it possible use Cytoscape UI extensions in Typescript? Layout extension can be used but when I need for example https://github.com/cytoscape/cytoscape.js-cxtmenu, I cant call function cy.cxtmenu( defaults ) because it isnt in cytoscape interface. Is there a way to use it?
My code in index.ts:
import cytoscape = require('cytoscape');
import contextMenus = require('cytoscape-cxtmenu');
cytoscape.use(contextMenus);
const cy = cytoscape({
container: document.getElementById('cy'),
...
});
let defaults = {
menuRadius: 100,
selector: 'node',
//...
};
let menu = cy.cxtmenu( defaults );
To index.d.ts I add this declare:
declare module 'cytoscape-cxtmenu' {
const ext: cytoscape.Ext;
export = ext;
}
In console during transpilation I get this:
ERROR in [at-loader] ./src/index.ts:152:17
TS2339: Property 'cxtmenu' does not exist on type 'Core'.