I am trying to create tree visualization to my react project. When I added a package 'react-tree-graph' and import Tree module from it:
import Tree from 'react-tree-graph'
it shows me this error:
Could not find a declaration file for module 'react-tree-graph'. 'd:/Downloads/CureAssure/F22-011-R-CureAssure/node_modules/react-tree-graph/dist/index.js' implicitly has an 'any' type. Try
npm i --save-dev @types/react-tree-graph
if it exists or add a new declaration (.d.ts) file containingdeclare module 'react-tree-graph';
I added the package using
yarn add react-tree-graph
Because I am using Yarn Package Manager.
I thought it might solved by using, npm, So I tried
npm install react-tree-graph --save
But the error remains same.
I visited the question Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type, and came to know that the error maybe due to .d.ts file, but I don't know why it is not in the folder.
In node_modules, there exists a folder react-tree-graph with these files:
│ CHANGELOG.md
│ LICENSE
│ package.json
│ README.md
│
├───dist
│ │ index.js
│ │ index.min.js
│ │ style.css
│ │ style.min.css
│ │
│ └───module
│ │ d3.js
│ │ index.js
│ │ wrapHandlers.js
│ │
│ └───components
│ animated.js
│ animatedTree.js
│ container.js
│ link.js
│ node.js
│ tree.js
│
├───node_modules
│ └───@babel
├───src
│ │ d3.js
│ │ index.js
│ │ wrapHandlers.js
│ │
│ └───components
│ animated.js
│ animatedTree.js
│ container.js
│ link.js
│ node.js
│ tree.js
│
└───styles
style.css