News for hackers. Stuff that matters.
Re:How an Anti-TypeScript “JavaScript developer” like me bec... by sholladay on Tuesday March 02, 2021 @11:19PM (#26324705)
My issue with TypeScript is that it simultaneously has some complex features that result in types that are hard to follow and yet it also lacks simple abilities like creating a type for a number within a certain range. I end up wanting to use Joi to further validate the types, not because I need runtime validation, but just because it's significantly more thorough and in some cases easier to read, too. But then I end up with a lot of duplication between Joi and TypeScript. It holds a lot of promise but there's too much friction there.
Re:How an Anti-TypeScript “JavaScript developer” like me bec... by panzerklein on Wednesday March 03, 2021 @12:16AM (#26325051)
Supporting static range types is crazy hard. Only full-on math languages like Idris can do that. If you need runtime checks and types without duplication use something later like zod or io-ts. They can derive ts types automatically