uber / react-digraph

A library for creating directed graph editors
MIT License
2.62k stars 269 forks source link

GridView component typing definition of gridSize prop #337

Closed PiotrObrebski closed 2 years ago

PiotrObrebski commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-digraph@6.7.1 for the project I'm working on.

GraphView component accepts gridSize to be defined with typical CSS values however typescript definition accepts only number or undefined.

Here is the diff that solved my problem:

diff --git a/node_modules/react-digraph/typings/index.d.ts b/node_modules/react-digraph/typings/index.d.ts
index e29bd9c..6a02005 100644
--- a/node_modules/react-digraph/typings/index.d.ts
+++ b/node_modules/react-digraph/typings/index.d.ts
@@ -103,7 +103,7 @@ declare module 'react-digraph' {
     edgeHandleSize?: number;
     edgeTypes: any;
     gridDotSize?: number;
-    gridSize?: number;
+    gridSize?: number | string;
     gridSpacing?: number;
     layoutEngineType?: LayoutEngineType;
     maxTitleChars?: number;
PiotrObrebski commented 2 years ago

I realized how you calculate from the gridSize and it should be in fact number.