-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
Remove exclusive
from minLength
, maxLength
, after
, and before
schemas
#992
Comments
One downside to this is we'd have to start doing type-level math to keep types accurate. Not the end of the world but it is nice having a way to represent without doing that, and I imagine more performant. Out of interest, what's the motivation for removing the |
@TizzySaurus Yeah that's right and it's a good insight. Especially problematic for Dates but probably just not that important to handle the distinction between whether a time range includes a particular millisecond or not at a type-level 😆 It is more accurate at runtime in terms of reducing equivalent types and cuts back on the clutter when defining signatures for chaining like this: |
I see. That makes perfect sense, thanks! |
I did some initial work on this but it was a bit of a problem for some tests to not allow exclusive on length or Date schemas. Worth revisiting this at some point for the extra normalization but not going to tackle this right away. It should be handled at the schema=>inner parse level rather than the arktype level. |
In
arktype
we should still allowstring>0
, but instead of being parsed into{minLength: {rule: 0, exclusive: true}}
, it should just become{ minLength: 1 }
. We can do the same forDate
by incrementing the numeric value of the Date by one for exclusivity.We need to keep
exclusive
for min/max because of non-integer values.The text was updated successfully, but these errors were encountered: