zcreativelabs / react-simple-maps

Beautiful React SVG maps with d3-geo and topojson using a declarative api.
https://www.react-simple-maps.io/
MIT License
3.07k stars 424 forks source link

TypeScript type definitions #98

Open janis91 opened 6 years ago

janis91 commented 6 years ago

I am wondering if there is already someone who started with the type definitions for this project. I think it would open the project for an even bigger audience.

What is your opinion on that?

thepocp commented 5 years ago

I added type definitions. @types/react-simple-maps

chrisbodhi commented 5 years ago

@thepocp Thanks! I'm running into an issue, though, where trying to add an onClick handler to <Geography> is resulting in a compiler error:

Type '{ key: number; geography: any; projection: (point: [number, number]) => void; onClick: (e: SyntheticEvent<Element, Event>) => void; style: { default: any; hover: { fill: string; stroke: string; strokeWidth: number; outline: string; }; pressed: { ...; }; }; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Geography> & Readonly<{ children?: ReactNode; }> & Readonly<GeographyProps>'.
  Property 'onClick' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Geography> & Readonly<{ children?: ReactNode; }> & Readonly<GeographyProps>'.

For the code that's being used, it's based on this example.

thepocp commented 5 years ago

@chrisbodhi I fixed it

pronebird commented 5 years ago

@thepocp thanks for that!

https://www.npmjs.com/package/@types/react-simple-maps

illepic commented 4 years ago

As of Jan. 2, 2020, it looks like the published types are for for 0.12.2 but the current version is 1.0.0-beta.0 which causes mismatches.

thepocp commented 4 years ago

I created a pull request: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/41370

raksooo commented 4 years ago

I'm having some trouble with the projection prop on ComposableMap. It's type is string | ProjectionFunction but as far as I can tell from the code it should be string | GeoProjection. Is that correct? Should I create a PR?

michael-lumley commented 3 years ago

It seems that the types for react-simple-maps have fallen significantly behind the current version.