iVis-at-Bilkent / cytoscape.js-grid-guide

A Cytsocape.js extension to provide a framework for grid interactions such as grid lines and snapping to grid, and guidelines and snap support for alignment of nodes.
MIT License
58 stars 9 forks source link

Typescript / Angular 14 support #56

Open florianeichincode opened 1 year ago

florianeichincode commented 1 year ago

I have trouble to import the grud guide module to my angular project.

I get the following error:

Could not find a declaration file for module 'cytoscape-grid-guide'. '/home/user/xxx/node_modules/cytoscape-grid-guide/src/index.js' implicitly has an 'any' type. Trynpm i --save-dev @types/cytoscape-grid-guideif it exists or add a new declaration (.d.ts) file containingdeclare module 'cytoscape-grid-guide';``

Is there a typescript type definition that i can use? Maybe you can create one for npm?

feichin-noreja commented 5 months ago

Came back to this topic. Solution;

import 'cytoscape-grid-guide';

this.cy?.gridGuide({ // Configure the grid guide plugin gridSpacing: 50, // Example spacing snapToGrid: true // Example option // Add more options as needed });

Add a cytoscape.d.ts file with declare module 'cytoscape' { interface Core { gridGuide(options?: any): void; } }