I am currently working on integrating d3 v4 into a typescript project through jspm and systemjs. Successfully importing d3 with the following code:
import * as d3 from 'd3';
This import allows me to perform selections, but when trying to use the attr function with an object, it does not work. Upon further investigation, I discovered that d3 v4 has this functionality in a separate module.
After downloading the d3-selection-multi module using jspm, I attempted to import it into my project like this:
import * as d3 from 'd3';
import 'jspm_packages/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c782f316f7970797f687573723171697068755c2d322c32">[email protected]</a>';
However, when trying to use the attrs function, I encountered the following error in the console:
(index):40 Error: (SystemJS) d3.selectAll(...).data(...).style(...).attrs is not a function(…)
I am also facing some compile errors which occur consistently, yet the code still compiles and runs successfully.
error TS2307: Cannot find module 'd3'
error TS1110: Type expected
If anyone can provide insight into what might be going wrong and offer a solution, it would be much appreciated.