-
Notifications
You must be signed in to change notification settings - Fork 328
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
Type Errors and Context as NonEmptyArray #670
Comments
devkat
added a commit
to devkat/io-ts
that referenced
this issue
Nov 2, 2022
devkat
added a commit
to devkat/io-ts
that referenced
this issue
Nov 2, 2022
devkat
changed the title
Type Errors as NonEmptyArray
Type Errors and Context as NonEmptyArray
Nov 2, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
🚀 Feature request
Current Behavior
Errors
andContext
are typed asArray
:Desired Behavior
Errors
should be typed asNonEmptyArray
, since the absence of errors would constitute a success (either.Right
):See also https://zio.github.io/zio-prelude/docs/functionaldatatypes/validation
Context
should be typed asReadonlyNonEmptyArray
since at least one context should exist for an error:Suggested Solution
See pull request
Who does this impact? Who is this for?
The solution simplifies error handling since the user can rely on the fact that at least one error with at least one context is present.
Describe alternatives you've considered
–
Additional context
–
Your environment
The text was updated successfully, but these errors were encountered: