Hacker News new | ask | show | jobs
by watermelon0 1759 days ago
Personally, I gave up on io-ts due to FP complications, and use suretype instead.

In my case, where I was parsing HTTP request body, it just simplifies the code, if I can call a single function, get back validated object of the expected type, or throw an exception if there is a problem.

Global request handler takes care of catching validation exception, and returning back user friendly error on what field(s) failed validation.

1 comments

suretype looks interesting, will have to do a bit of review there. One of the things we're now doing is using io-ts for both encoding and decoding types. Internally we're more JSON than gRPC so we're using it to provide a standardized way to move data between components.