News for hackers. Stuff that matters.
Re:TypeScript 4.1 by neurotrace on Friday November 20, 2020 @12:22AM (#25157541)
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
Re:TypeScript 4.1 by eropple on Monday November 23, 2020 @01:09PM (#25189668)
That's what runtypes is.