Forum Discussion

jerometay's avatar
jerometay
Frequent Visitor
5 years ago
Solved

Typescript Error: .attr("d", d3.geoPath())

Hi!   I'm developing a custom d3 map visual with geojson data. The map is drawn with this d3 svg element declared as shown below. let landSvg: d3.Selection<SVGElement, any, any, any> = this.svg....
  • jerometay's avatar
    jerometay
    5 years ago

    Thanks for the reply Lionel, although I'm not sure where is the solution is in the video link you posted though.

     

    In any case, for anyone else having the same problem, I have found the reason why the error appears.

    The issue in my case is because the wrong version of @types/d3-selection was pulled in.

    In the default version of the package.json that is created by pbiviz for new projects, the dependency for @types/d3 is 5.7.2 and the link for d3-selection is a @types/d3-selection@* instead of ^1 which pulls in the latest version that is supposed to be used in d3v6 instead of d3v5.

    This issue causes other problems as well as the d3.event is unavailable (in v6 the event object is passed into the listener).

    How to fix this is described here

    Just change the liner in the package.json for @types/d3 to the latest v5 and the error will magically disappear. i.e. they fixed the link in the latest version.