Re:All I Want for Christmas Is These Seven TypeScript Improv...
by Gigachad on Sunday December 25, 2022 @11:42PM
(#34134665)
Why should types even exist at runtime? Everything should be validated at compile time and then the whole concept of types no longer needs to exist.
[ Parent
| on HN ]
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by DangitBobby on Monday December 26, 2022 @02:57AM
(#34135678)
You are sometimes interacting with external data. Particularly in web land, you don't know for sure if the payload meets expectations until you check.
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by pharmakom on Monday December 26, 2022 @05:20AM
(#34136384)
Plenty of solutions here such as code generation or Elm style combinators. Iām not convinced that Python style runtime meta programming is a particular robust solution since it is not (easily) checked statically.
Re:All I Want for Christmas Is These Seven TypeScript Improv...
by DangitBobby on Monday December 26, 2022 @05:41PM
(#34142719)
Sure. But it would be nice not to need to describe the structure of your data twice if you need runtime validation. Since TS is such an ergonomic way of describing the structure of your types, runtime availablility is more attractive (to some) than relying on external libraries for that functionality.