-
-
Notifications
You must be signed in to change notification settings - Fork 654
Add LiteralList and JoinUnion types
#1159
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
base: main
Are you sure you want to change the base?
Conversation
**Added**: - `LiteralList` a validator to check if a Tuple have exactly one of each member in given Union, No duplicate, Extras, or Less elements. - `JoinUnion` join a union members with the given delimiter (default: ','). **Modified** - `Join` delimiter (default: ','). Like `Array.join` default behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR doesn't look like it's ready.
Also, this needs further discussion about whether we want to do a type that returns error strings. And, this doesn't really close #904.
ur right this is a weird scenario to return strings as Errors, like they are not needed actually but they can add a visual reason why the type is erroring. we can remove them in case @sindresorhus refuses. and lets be honest making the type #904 as suggested is not wort the effort for 4/5 union members |
|
@sindresorhus Can u give a thought on returning the string Errors so we can go forward. |
|
I agree that returning Error is kinda weird, but since there is no other way to report errors to the users, I'm kinda willing to do it, because some weird Error is better than no indication of what's wrong. I assume this solution does not suffer from performance issues like the one proposed in #904? |
- Fix: Corrected behavior when handling infinite-length lists (no longer returns true). - Add: Added comprehensive tests and documentation for `LiteralList`. - Improve: Enhanced error message formatting for clearer diagnostics.
|
@som-sm @sindresorhus I improved the errors! I think they look good and match with ts errors look |
|
@som-sm PR is ready, can u review ! |
|
Please run everything through AI, as requested multiple times on other pull requests (please do it on all your pull requests). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sindresorhus Fixed Capitalized words in Error phrases
|
@som-sm Approved ! |
|
Yeah, I'm aware. I'll get to this sometime this week. |
|
@som-sm, Hey 👋 just following up on this, you mentioned you’d review it next week, but I haven’t seen any updates yet. |
Co-authored-by: Sindre Sorhus <[email protected]>
Co-authored-by: Sindre Sorhus <[email protected]>
|
@som-sm Could you please take some time to review this PR when you get a chance, so we can move it forward? |





Closes #904
Added:
LiteralLista validator to check if a Tuple have exactly one of each member in given Union, No duplicate, Extras, or Less elements.JoinUnionjoin a union members with the given delimiter (default: ',').Example:
Errors example


