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

Invalid type on LngLatBounds.extend #8065

Closed
fc opened this issue Mar 21, 2019 · 5 comments
Closed

Invalid type on LngLatBounds.extend #8065

fc opened this issue Mar 21, 2019 · 5 comments

Comments

@fc
Copy link
Contributor

fc commented Mar 21, 2019

It appears that LngLatLike and LngLatBoundsLike should also be allowed since the convert methods used here accept those types:
https://github.com/mapbox/mapbox-gl-js/blob/master/src/geo/lng_lat_bounds.js#L85-L91

I believe it is just a matter of changing it in the comments and in the type definition:
LngLat | LngLatBounds to LngLat | LngLatBounds | LngLatLike | LngLatBoundsLike, or to just LngLatLike | LngLatBoundsLike - not sure off the top of my head if the instanceof call will need LngLat to be explicitly set as a type (refer to lines 74 and 78).

I haven't created a PR since I don't have the time to test right now....but should be enough info for someone to look into it.

mapbox-gl-js version:
Latest version

Expected Behavior

No type errors

Actual Behavior

Invalid types
Something like this will fail TypeScript type checks:

bounds.extend([number, number]);
@fc
Copy link
Contributor Author

fc commented Mar 22, 2019

@types/mapbox-gl will also need to be updated once a fix here has been done:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/mapbox-gl/index.d.ts#L883

@asheemmamoowala
Copy link
Contributor

@fc Thanks for the detailed issue, want to submit a PR?

@marcofugaro
Copy link

any updates on this? should @types/mapbox-gl be updated to v1.0.0?

@asheemmamoowala
Copy link
Contributor

any updates on this?

We would welcome a PR contribution for the issue in the OP.

should @types/mapbox-gl be updated to v1.0.0?

Could you please create a separate issue for this

@sgolbabaei
Copy link
Contributor

closed by #9293

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

No branches or pull requests

5 participants