react-simple-maps icon indicating copy to clipboard operation
react-simple-maps copied to clipboard

TypeScript type definitions

Open janis91 opened this issue 7 years ago • 8 comments
trafficstars

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?

janis91 avatar Aug 30 '18 06:08 janis91

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

thepocp avatar Jan 04 '19 12:01 thepocp

@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.

chrisbodhi avatar Jan 05 '19 22:01 chrisbodhi

@chrisbodhi I fixed it

thepocp avatar Jan 08 '19 09:01 thepocp

@thepocp thanks for that!

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

pronebird avatar Jan 28 '19 15:01 pronebird

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.

illepic avatar Jan 02 '20 17:01 illepic

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

thepocp avatar Jan 03 '20 14:01 thepocp

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?

raksooo avatar Sep 03 '20 14:09 raksooo

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

michael-lumley avatar Apr 18 '21 18:04 michael-lumley