question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

error TS7016: Could not find a declaration file for module 'd3-scale'. Versions 19.1.0 through 20.1.0

See original GitHub issue

Describe 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 containing declare 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 containing declare 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 containing declare 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 containing declare 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:open
  • Created 2 years ago
  • Reactions:13
  • Comments:17

github_iconTop GitHub Comments

36reactions
bbarrycommented, Oct 12, 2021

you should specify @types/d3 in peer dependencies

this is a bug

22reactions
BingeCodecommented, Oct 12, 2021

you should install @types/d3 in dev dependencies

this is not a bug

Newly installed ngx-charts today in my Angular project and this fixed it for me.

npm install @types/d3 --save-dev

Read more comments on GitHub >

github_iconTop Results From Across the Web

Could not find a declaration file for module 'module-name ...
In Node.js everything works fine, but TypeScript: import {Injector} from '@ts-stack/di' ...
Read more >
How to fix error TS7016: Could not find a declaration file for ...
Try `npm install @types/XYZ` if it exists or add a new declaration (.d.ts) file containing `declare module 'XYZ';. If XYZ is a direct...
Read more >
Fixing the TS7016 Error | Atomist Blog
Could not find declaration file -- How do you get past the TS7016? This article highlights the eight best and worst fixes. Blog...
Read more >
Error: Could not find a declaration file for module - YouTube
Fix error : Could not find a declaration file for module ... implicitly has an 'any' type.Try npm install library-name if it exists...
Read more >
@types/d3 - npm
TypeScript definitions for D3JS d3 standard bundle. Latest version: 7.4.0, last published: 7 months ago. Start using @types/d3 in your ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found