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

fixes array types to allow length > 1 #18

Merged
merged 1 commit into from
Sep 23, 2021

Conversation

pietrovismara
Copy link
Contributor

The current types force the length of the properties objects and nodes to be 1. The same is true for getIndex and retrieve.

With this fix typescript will stop complaining about things like this:

const rects = tree.retrieve(rect);
console.log(rects[1].x); // Tuple type '[Rect]' of length '1' has no element at index '1'.ts(2493)

@timohausmann timohausmann merged commit 1b4c367 into timohausmann:master Sep 23, 2021
@timohausmann
Copy link
Owner

Oh yes, thanks! These were my first TS steps.

If you like test the typescript branch, it‘s mostly done, I just still have to update some docs etc.

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

2 participants