Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Discrepancies in types defined on component level vs exported prop interface #2140

Closed
shirshendubhowmick opened this issue Mar 14, 2023 · 3 comments
Labels

Comments

@shirshendubhowmick
Copy link

shirshendubhowmick commented Mar 14, 2023

Description

The MapProps interface doesn't match with the props defined in component level.

While doing some thing like

<Map fog={props.fog} />

Where props: MapProps

Getting error like

image

This is not just limited to the fog but there couple of other props with same issue.

And doing something like this

<Map {...props} />

where props: MapProps, results in bunch of TS errors.

Looks like the cause for this is how the types are defined:
On the component level the fog props is defined as:

image

On MapProps interface it is defined as:

image

Expected Behavior

Prop types should be consistent across the exported MapProps interface and the component

Steps to Reproduce

Step to reproduce is explained in detail in the the description section

Environment

  • Framework version: react-map-gl: 7.0.21
  • Map library: mapbox-gl: 2.13.0
  • Browser: N/A
  • OS: MacOS

Logs

No response

@DiscoPapa
Copy link

Has this been addressed already? I see this being open for quite a while now. I get a similar issue. I'd love to get some feedback on this one.

image

I have done this for now, as a work-around, but as it works, it's not ideal:
image

Is there someone brave enough to create a pull request with this fix in the \react-map-gl\dist\esm\exports-mapbox.d.ts file? Would that work?

I would sincerely appreciate a response here. Thank you. Great work BTW.

@DiscoPapa
Copy link

DiscoPapa commented Dec 6, 2024

Oh, this is also another workaround you can use, until the types are amended in source code of this repo:

image

In summary, as originally mentioned property "fog" seems to no longer be an issue, these are, as seen in the screenshot above, still the problematic ones:

  • projection (should be of type ProjectionSpecification)
  • logoPosition (should be of type 'top-left' | 'top-right' | 'bottom-right' | 'bottom-left' | undefined)
  • terrain (should be of type TerrainSpecification | undefined)

@Pessimistress
Copy link
Collaborator

This is expected to be fixed in v8.0. Track progress on #2457.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants