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

Make TupleToUnion support T[] instead of just tuples #504

Merged
merged 1 commit into from
Nov 5, 2022

Conversation

trevorade
Copy link
Contributor

@trevorade trevorade commented Oct 24, 2022

This implementation is no longer recursive which may be more performant. It also works with arrays whereas the previous implementation only worked with tuples.

In addition, it also resolves an issue where infinite tuples were not supported. Previously, TupleToUnion<[string, ...number[]]> resolved to string and now it correctly resolves to string | number.

@trevorade trevorade force-pushed the update_tuple_to_union branch from 058dbdb to d173e41 Compare October 24, 2022 23:07
This implementation is simpler which may be more performant. It also works with arrays whereas the previous implementation only worked with tuples.
@trevorade trevorade force-pushed the update_tuple_to_union branch from d173e41 to 6f9bb49 Compare October 24, 2022 23:11
@sindresorhus
Copy link
Owner

// @mattmahn

@trevorade
Copy link
Contributor Author

Any clarification you'd like @mattmahn or @sindresorhus?

@sindresorhus sindresorhus requested a review from skarab42 November 4, 2022 06:48
@sindresorhus sindresorhus merged commit a68f6b2 into sindresorhus:main Nov 5, 2022
@buschtoens
Copy link
Contributor

I just wanted to leave this comment to appreciate that this works now and that you've submitted this PR. Thank you! ❤️

@trevorade trevorade deleted the update_tuple_to_union branch November 6, 2022 14:03
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