Re:A lightweight TypeScript library for assertion-based runt...
by yencabulator on Wednesday August 27, 2025 @06:31PM
(#45046150)
A useful counterexample, where one wants to see all errors, is validating form input. But it's very much ok to say your library is not meant for that use case!
Re:A lightweight TypeScript library for assertion-based runt...
by nayajunimesh on Wednesday August 27, 2025 @09:08PM
(#45047157)
That is a good point! How do you feel about fail-fast by default but being able to configure a validator to collect all errors (like Zod does by default)? Something like array(number(), { failFast: false });
We currently expose error as a tree structure so that it's easy to map an error to a value or build custom error messages (we only provide debug error message) and I haven't been able to come up with a satisfactory error API that accommodates multiple error paths, but you raise an excellent point. Thanks for pointing out.
Re:A lightweight TypeScript library for assertion-based runt...
by yencabulator on Wednesday August 27, 2025 @10:04PM
(#45047522)
My instinct is to say keep it small, simple & focused.
My overall takeaway has mostly been to not optimize for the worst case by default. Keep fail-fast as baseline for boundaries and hot paths, and selectively enable “collect all” where it demonstrably saves human time.