Live data from Hacker News

Show HN: TypeScript types that conform to JSON schemas without code generation

github.com

1–2 of 2 posts

Re: Show HN: TypeScript types that conform to JSON schemas without code generation

#2
This library allows you to write code that generates Typescript type/JSON schema pairs 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.

Hope it's useful to someone!