Skip to content

Commit

Permalink
Merge pull request #113 from usr14/typescript-types
Browse files Browse the repository at this point in the history
Typescript types
  • Loading branch information
crubier authored Apr 9, 2022
2 parents 98747f2 + 8d7ea32 commit 463323a
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
32 changes: 32 additions & 0 deletions lib/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
declare module "react-graph-vis" {
import { Network, NetworkEvents, Options, Node, Edge, DataSet, Data } from "vis";
import { Component } from "react";

export { Network, NetworkEvents, Options, Node, Edge, DataSet, Data } from "vis";

export type GraphEvents = {
[event in NetworkEvents]?: (params?: any) => void;
};

export interface NetworkGraphProps {
graph: Data;
options?: Options;
events?: GraphEvents;
getNetwork?: (network: Network) => void;
identifier?: string;
style?: React.CSSProperties;
getNodes?: (nodes: DataSet<Node>) => void;
getEdges?: (edges: DataSet<Edge>) => void;
}

export interface NetworkGraphState {
identifier: string;
}

export default class NetworkGraph extends Component<
NetworkGraphProps,
NetworkGraphState
> {
render();
}
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.7",
"description": "A react component to render nice graphs using vis.js",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel -d lib/ src/",
Expand Down Expand Up @@ -33,6 +34,8 @@
"vis-network": "^9.0.0"
},
"devDependencies": {
"@types/react": "^17.0.4",
"@types/vis": "^4.21.21",
"babel-cli": "^6.22.2",
"babel-preset-env": "^1.1.8",
"babel-preset-stage-3": "^6.22.0"
Expand Down

0 comments on commit 463323a

Please sign in to comment.