4 ms·
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 cod
by watermelon0 5y 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.
- koblas 5y agosuretype 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.