3 ms·
Ha! That's the reason I started working on https://github.com/bcherny/json-schema-to-typescript https://github.com/bcherny/json-schema-to-typescript. For the r
by bcherny 10y ago
Ha! That's the reason I started working on https://github.com/bcherny/json-schema-to-typescript https://github.com/bcherny/json-schema-to-typescript.
For the record, JSON Schemas are quite a bit more expressive than TypeScript interfaces, or even Scala Traits. I actually put together a big list of every JSON Schema constraint that isn't checkable at compile time in TS: https://github.com/bcherny/json-schema-to-typescript#not-expressible-in-typescript https://github.com/bcherny/json-schema-to-typescript#not-exp....
- skrebbel 10y agoCool stuff! Fair enough on the constraints. One of the design goals I had at the time was that I didn't want stuff like that to be expressible. Basically, it felt over the top to me - you might as well just allow writing predicates in plain JS then. Even more expressive! My primary goal was a spec language for humans to read and write. Machine validation came second. TypeScript, oddly maybe, appears to have a similar design goal.