4 ms·
Not op, but I have experience with TS and some things are more difficult than they should be. For me the biggest issue is the lack of typesafe deserialisation.
by mxz3000 6y ago
Not op, but I have experience with TS and some things are more difficult than they should be. For me the biggest issue is the lack of typesafe deserialisation. This makes it super painful to do IO (of which there's _a lot_ of in the serverless infrastructure I'm currently working on). While you can validate with a manually written type guard, that's a pain... It would great if you could do JSON.parse<T>() and have TS auto-generate the type guard for you...
There's also no easy way to switch on union types (à la ocaml), sure you can define an enum and use a JS switch, but that's not as nice, and enforcing exhaustiveness of the switch requires some type hackery with `never`...
- mixedCase 6y agoio-ts does this. Although it's the other way around: you write the type guard (API is similar to writing a type) and it gives you the type for free.