d3 / d3-geo-projection

Extended geographic projections for d3-geo.
https://observablehq.com/collection/@d3/d3-geo-projection
Other
1.1k stars 201 forks source link

Using this lib in TypeScript? #202

Closed breck7 closed 3 years ago

breck7 commented 3 years ago

Struggling to get this cleanly working with Typescript. Get the ole "Could not find a declaration file for module 'd3-geo-projection'" error.

I remember there's a way to do with with some type of declaration files, but thought I'd start an issue in case other people are trying to use this in TypeScript as well and having similar problem.

Maybe we could get types added or add some readme docs on simplest way to do it. (Will try and remember to post my best solution).

Edit: there are various ways to do it, but because there are so many permutations of tsconfig.json and TS project structures, not sure what the simplest way is that would work for most use cases. That probably could be getting npm install @types/d3-geo-projection to work, but not sure. Maybe if anyone else out there has experience with this they could chime in with recommended steps.

Fil commented 3 years ago

D3 defers to https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/d3/index.d.ts ; it seems they don't yet have a declaration file for d3-geo-projection, but that's probably something they would want to add?

Dimava commented 1 year ago

@Fil any updateds on this?