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

Group.toBound's return type wrongly marked as Group #214

Closed
ii41 opened this issue May 6, 2024 · 0 comments · Fixed by #215
Closed

Group.toBound's return type wrongly marked as Group #214

ii41 opened this issue May 6, 2024 · 0 comments · Fixed by #215

Comments

@ii41
Copy link
Contributor

ii41 commented May 6, 2024

As a convenience method for creating a Bound from a group, this wrong type annotation makes it less convenient... Type check wrongly complains about passing a Group where a Bound is expected and we don't get completion on Bound's members.

pts/src/Pt.ts

Lines 946 to 947 in 47de4b7

toBound():Group {
return Bound.fromGroup( this );

ii41 added a commit to ii41/pts that referenced this issue May 7, 2024
…illiamngan#214

2. `Bound` stores top left and bottom right `Pt`s separately. Close williamngan#213

For 2, top left and bottom right `Pt`s were separate from `Pt`s that are
indexable using integers.

This causes that, when a calculation method such as `add` inherited from
`Group` is used on a `Bound`, the `Bound`'s corner `Pts`s are sometimes
not updated, as `Group` uses integer indices for getting the member
`Pt`s.

In order to fix this, the separate members `_topLeft` and `_bottomRight`
are removed from `Bound`. `topLeft` and `bottomRight` are now just
getters for integer-indexable `Pt`s.
ii41 added a commit to ii41/pts that referenced this issue May 7, 2024
1. `Group.toBound`'s return type was wrongly marked `Group`. Closes williamngan#214
2. `Bound` stores top left and bottom right `Pt`s separately. Close williamngan#213

For 2, top left and bottom right `Pt`s were separate from `Pt`s that are
indexable using integers.

This causes that, when a calculation method such as `add` inherited from
`Group` is used on a `Bound`, the `Bound`'s corner `Pts`s are sometimes
not updated, as `Group` uses integer indices for getting the member
`Pt`s.

In order to fix this, the separate members `_topLeft` and `_bottomRight`
are removed from `Bound`. `topLeft` and `bottomRight` are now just
getters for integer-indexable `Pt`s.
williamngan pushed a commit that referenced this issue May 19, 2024
1. `Group.toBound`'s return type was wrongly marked `Group`. Closes #214
2. `Bound` stores top left and bottom right `Pt`s separately. Close #213

For 2, top left and bottom right `Pt`s were separate from `Pt`s that are
indexable using integers.

This causes that, when a calculation method such as `add` inherited from
`Group` is used on a `Bound`, the `Bound`'s corner `Pts`s are sometimes
not updated, as `Group` uses integer indices for getting the member
`Pt`s.

In order to fix this, the separate members `_topLeft` and `_bottomRight`
are removed from `Bound`. `topLeft` and `bottomRight` are now just
getters for integer-indexable `Pt`s.
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 a pull request may close this issue.

1 participant