To turn TypeScript interfaces into JSON schemas, then evaluating incoming JSON using whatever JSON schema validation library you want. It's a tradeoff though, as this replaces the need for "t.TypeOf" with some kind of separate build step that creates the schemas. I still prefer it though, as it allows me to use standard TS interfaces rather than any kind of custom format.
This is nice, but I'd prefer to use mobx-state-tree to reason about models and the logic around them. The ability to use middleware to implement things like undo [1], is really powerful.
Looks nice; I use “decoders” with Flow for this use case myself. Can even avoid doubling up in type/parsing definitions by deriving the type of the result via inference, from the decoder. Excited to play with this for my TypeScript projects.
This is awesome. I was looking for this a few weeks ago and found a library I don’t love. This feels right for Typescript and I’m going to add it to a big project like immediately. Great job to the authors!
Nice to see another feature of TypeScript that PureScript and Elm had for years.
I will certainly use it tomorrow! (Unless I use typescript-json-schema, which is awesome too!)
https://github.com/YousefED/typescript-json-schema
To turn TypeScript interfaces into JSON schemas, then evaluating incoming JSON using whatever JSON schema validation library you want. It's a tradeoff though, as this replaces the need for "t.TypeOf" with some kind of separate build step that creates the schemas. I still prefer it though, as it allows me to use standard TS interfaces rather than any kind of custom format.