visgl / react-map-gl

React friendly API wrapper around MapboxGL JS
http://visgl.github.io/react-map-gl/
Other
7.88k stars 1.36k forks source link

[Bug] Fix to typing issue didn't propagate #2261

Closed trumbitta closed 1 year ago

trumbitta commented 1 year ago

Description

Ref: https://github.com/visgl/react-map-gl/pull/2250

Repro: https://codesandbox.io/p/sandbox/wispy-thunder-tx58mq

The fix on the types generated from https://github.com/visgl/react-map-gl/blob/a5705d06b682ef8b52c811b6744f7e11e774ddf4/src/components/use-map.tsx#L55 didn't propagate automatically to the types generated from https://github.com/visgl/react-map-gl/blob/a5705d06b682ef8b52c811b6744f7e11e774ddf4/src/exports-mapbox.ts#L47

So there's still one lingering instance of the original issue.

I'm not sure what the fix should be. I'm not familiar with what you are using to generate types, and with how you want them to be inferred or whatever 🙇

Expected Behavior

Running tsc on a project which imports react-map-gl won't return any error

Steps to Reproduce

See repro at https://codesandbox.io/p/sandbox/wispy-thunder-tx58mq

Environment

Logs

node_modules/react-map-gl/dist/esm/exports-mapbox.d.ts:19:5 - error TS2411: Property 'current' of type 'MapRef<Map> | undefined' is not assignable to 'string' index type 'MapRef<Map>'.

19     current?: _MapRef<MapboxMap>;
       ~~~~~~~

Found 1 error in node_modules/react-map-gl/dist/esm/exports-mapbox.d.ts:19
Pessimistress commented 1 year ago

v7.1.5