4 ms·
You can use guard functions to validate external data. This same problem comes up in other statically typed languages. You can't guarantee that external data wi
by neurotrace 6y ago
You can use guard functions to validate external data. This same problem comes up in other statically typed languages. You can't guarantee that external data will be in the shape that you expect so you must validate it. If you're just taking your `unknown` API response and immediately casting it to your desired type then that's your fault, not TS
- eropple 6y agoThat's what runtypes is.