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

Include MultiLineString output type for greatCircle module #1928

Merged
merged 3 commits into from
Nov 17, 2020

Conversation

kronick
Copy link
Contributor

@kronick kronick commented Jul 14, 2020

This PR updates the Typescript type definitions and corresponding docs for the greatCircle function to include the possibility of returning a MultiLineString when the input spans the antimeridian. This is described as expected behavior in this issue. Without this fix, Typescript will return an error if you try to test, for example:

const greatCircleGeojson = greatCircle(start, end);
if(greatCircleGeojson?.geometry.type === "MultiLineString") {
 // ... handle this case
}

Typescript complains: This condition will always return 'false' since the types '"LineString" | undefined' and '"MultiLineString"' have no overlap.

@kronick kronick force-pushed the kronick/fix-great-circle-types branch from be22a50 to 2439f49 Compare July 16, 2020 01:40
Copy link
Member

@rowanwins rowanwins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks @kronick !

@kronick
Copy link
Contributor Author

kronick commented Jul 17, 2020

@rowanwins Thanks for the ✅ — will you handle merging this for the next release? Is there anything else I need to do?

@regileeso
Copy link

I'd love to see these changes in a new release as soon as possible 👍

@mfedderly mfedderly merged commit 1d33cbe into Turfjs:master Nov 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants