Skip to content

Invalid type on LngLatBounds.extend #8065

Description

@fc

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]);

Activity

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions