Skip to content

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.

2 participants