kaluginserg / cytoscape-node-html-label

Labels for cytoscape node. Demo:
https://kaluginserg.github.io/cytoscape-node-html-label/
MIT License
102 stars 43 forks source link

Cannot declare and use cytoscape-node-html-label for typescript project. #78

Open Sagar-PH opened 1 year ago

Sagar-PH commented 1 year ago

It would be helpful if u provide or find any similar dependencies of same features or provide @types/cytoscape-node-html-label dependency so that it would be useful that i can use in my typescript project.

zdenekhynek commented 11 months ago

Following worked for me to quickly test this in a typescript project

# typings.d.ts
declare module "cytoscape-node-html-label";
# test-cytoscape.ts
import { Core } from "cytoscape";
import nodeHtmlLabel, { CytoscapeNodeHtmlParams, CytoscapeContainerParams } from "cytoscape-node-html-label";

export interface IExtendedCytoscapeCore extends Core {
  nodeHtmlLabel: (options: CytoscapeNodeHtmlParams[], params?: CytoscapeContainerParams) => void;
}

const cy = cytoscape(opts) as IExtendedCytoscapeCore;

Will probably become easier when https://github.com/kaluginserg/cytoscape-node-html-label/pull/45 is merged.