Cannot find module d3 or its corresponding type declarations
See original GitHub issueDescribe the Bug
After updating to v10, builds fail because it fails to find d3 or d3-transitions
node_modules/react-flow-renderer/dist/esm/types/general.d.ts:2:56 - error TS2307: Cannot find module 'd3' or its corresponding type declarations.
2 import { Selection as D3Selection, ZoomBehavior } from 'd3';
~~~~
node_modules/react-flow-renderer/dist/esm/utils/graph.d.ts:1:42 - error TS2307: Cannot find module 'd3' or its corresponding type declarations.
1 import { Selection as D3Selection } from 'd3';
~~~~
node_modules/react-flow-renderer/dist/esm/utils/graph.d.ts:15:128 - error TS7016: Could not find a declaration file for module 'd3-transition'. 'C:/monolith/packages/hub/node_modules/d3-transition/src/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/d3-transition` if it exists or add a new declaration (.d.ts) file containing `declare module 'd3-transition';`
15 export declare const getD3Transition: (selection: D3Selection<Element, unknown, null, undefined>, duration?: number) => import("d3-transition").Transition<Element, unknown, null, undefined>;
~~~~~~~~~~~~~~~
I’m using Vite v2.6.4 to build the package.
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
- Install react-flow-renderer
- run
tsc && vite build
- Build fails
Expected behavior
Build with no errors
Screenshots or Videos
No response
Platform
react-flow-renderer: v10.3.14 vite: 2.6.3 react: 18.2.0
Additional context
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Cannot find module "d3" error is displayed after i upgraded my ...
Install the type declarations from npm: npm install @types/d3 --save-dev. You dont need typings. It is deprecated. The same for jquery.
Read more >[Solved]-Error: Cannot find module 'd3'-d3.js - appsloveworld
If you are wanting to require a module you must do npm install you should do npm init first and both should be...
Read more >Cannot find module “d3” error is displayed after i upgraded my ...
Cannot find module “d3” error is displayed after i upgraded my project from ionic 2 to ionic 3 - ionic-v3 - Ionic Forum....
Read more >error TS7016: Could not find a declaration file for ... - GitHub
The thing is my project does not make direct use of that @types/d3 , it is a dependency of @swimlane/ngx-charts , so they...
Read more >d3 - npm
Start using d3 in your project by running `npm i d3`. There are 4816 other projects in the npm registry using d3.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@barneaoren @sushantdhiman Thanks! This is fixed in v10.3.16
Hi @moklick , It is not necessary to include the
react
andreact-dom
types because they are peer dependencies that should be installed by consuming projects.