Thanks! I believe the actual code is handling this correctly but would love to read that paper – you don't happen to have another link, do you? https://www.escholar.manchester.ac.uk/ seems to be down for me.
There are a few gotchas, but I've introduced them at both Vanta and Q Bio and have been thrilled with the productivity increase at both places. As long as you stay on top of keeping prebuilds green, you know that everything just works for all of your engineers.
1) sure, but I figured I might as well implement all 4 operations for posterity. The `divideBy2` type would be not-that-dissimilar from the Even type.
2) Ha, if only! If that were true then we could prove all sorts of number-theoretic things by rewriting them in "types." Part of the point of this post is there is no magical power of types; they're just another programming language.
2) I didn't mean it would guarantee a proof, I just meant it would attempt a proof up to the limit of its type checker's ability to prove type validity.
This library allows you to write code that generates Typescript type/JSON schema pairs <T, s> such that
1. Any type that s can validate is assignable to T
2. As few objects as possible that are assignable to T cannot be validated by s.
This allows you to write JSON schemas and use the corresponding Typescript type without having to resort to code generation, maintaining two types side-by-side, or re-writing a whole JSON schema validator in something like io-ts.