Settings

Theme

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

github.com

17 points by robbieo 6 years ago · 1 comment

Reader

robbieoOP 6 years ago

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.

Hope it's useful to someone!

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection