error TS7016: Could not find a declaration file for module 'd3-scale'. Versions 19.1.0 through 20.1.0
See original GitHub issueDescribe the bug I updated my project to use the version 19.1.0, and now I get this build error:
✔ Browser application bundle generation complete.
Warning: C:\ClientApp\node_modules@swimlane\ngx-charts_ivy_ngcc_\fesm2015\swimlane-ngx-charts.js depends on ‘clone-deep’. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Error: node_modules/@swimlane/ngx-charts/lib/box-chart/box-chart.component.d.ts:5:40 - error TS7016: Could not find a declaration file for module ‘d3-scale’. ‘C:/ClientApp/node_modules/d3-scale/dist/d3-scale.js’ implicitly has an ‘any’ type. Try
npm i --save-dev @types/d3-scale
if it exists or add a new declaration (.d.ts) file containingdeclare module 'd3-scale';
5 import { ScaleLinear, ScaleBand } from ‘d3-scale’; ~~~~~~~~~~
Error: node_modules/@swimlane/ngx-charts/lib/box-chart/box-series.component.d.ts:2:40 - error TS7016: Could not find a declaration file for module ‘d3-scale’. ‘C:/ClientApp/node_modules/d3-scale/dist/d3-scale.js’ implicitly has an ‘any’ type. Try
npm i --save-dev @types/d3-scale
if it exists or add a new declaration (.d.ts) file containingdeclare module 'd3-scale';
2 import { ScaleLinear, ScaleBand } from ‘d3-scale’; ~~~~~~~~~~
Error: node_modules/@swimlane/ngx-charts/lib/box-chart/box.component.d.ts:2:26 - error TS7016: Could not find a declaration file for module ‘d3-selection’. ‘C:/ClientApp/node_modules/d3-selection/dist/d3-selection.js’ implicitly has an ‘any’ type. Try
npm i --save-dev @types/d3-selection
if it exists or add a new declaration (.d.ts) file containingdeclare module 'd3-selection';
2 import { BaseType } from ‘d3-selection’; ~~~~~~~~~~~~~~
Error: node_modules/@swimlane/ngx-charts/lib/bubble-chart/bubble-chart.utils.d.ts:1:52 - error TS7016: Could not find a declaration file for module ‘d3-scale’. ‘C:/ClientApp/node_modules/d3-scale/dist/d3-scale.js’ implicitly has an ‘any’ type. Try
npm i --save-dev @types/d3-scale
if it exists or add a new declaration (.d.ts) file containingdeclare module 'd3-scale';
1 import { ScaleLinear, ScalePoint, ScaleTime } from ‘d3-scale’;
ngx-charts version 19.1.0
Additional context when I revert to version 19.0.1, everything works again. Angular 12.2.9
Issue Analytics
- State:
- Created 2 years ago
- Reactions:13
- Comments:17
you should specify @types/d3 in peer dependencies
this is a bug
Newly installed ngx-charts today in my Angular project and this fixed it for me.
npm install @types/d3 --save-dev