0

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 containing declare 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

1 Answer 1

0

This is occurring due to unavailability of .ts support still in it. Hopefully it gets merged soon and the issue gets resolved

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.