I explained it was all about the type inference from the schema so I could make guarantees across runtime boundaries.
This is what I came up with, though this library looks like it may be more comprehensive than what I wrote. Struggled to come up with a good name to represent exactly what it did...
https://www.npmjs.com/package/type-safe-validator
The ability of the TypeScript compiler to allow this stuff continues to make it one of my favourite languages to work with, despite it still being JavaScript underneath.