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

Overload Polygon constructor for accuracy, loosen Point requirement. #6378

Merged
merged 4 commits into from
Feb 2, 2020

Conversation

andrewstart
Copy link
Contributor

@andrewstart andrewstart commented Feb 1, 2020

Description of change
  • Overloads the Polygon constructor to specify that you may pass in a single array of Points/numbers, or a list of Points/numbers. Attempting to pass in a list of arrays is now a compile error.
  • Updates linting rules to allow Typescript method overloading.
  • Changes the Point check inside the constructor to allow for anything fitting the IPoint interface rather than just Point instances, which is more relaxed - really this should allow simple {x, y} objects, but I wanted to keep this PR light.
Pre-Merge Checklist
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

A note on the no-dupe-class-members rule - the Typescript compiler will throw an error on a failure here, so it won't be as meaningful going forward. Additionally, there is an open PR to typescript-eslint to add their own variant that can handle overloading.

@bigtimebuddy bigtimebuddy added this to the v5.3.0 milestone Feb 1, 2020
@codecov-io
Copy link

codecov-io commented Feb 1, 2020

Codecov Report

Merging #6378 into dev will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@          Coverage Diff          @@
##             dev   #6378   +/-   ##
=====================================
  Coverage   74.7%   74.7%           
=====================================
  Files        105     105           
  Lines       6053    6053           
=====================================
  Hits        4522    4522           
  Misses      1531    1531

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88ca928...6dcc897. Read the comment docs.

@bigtimebuddy bigtimebuddy merged commit ad4230b into dev Feb 2, 2020
@bigtimebuddy bigtimebuddy deleted the polygon-overload branch February 2, 2020 16:53
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.

None yet

4 participants