a typescript utility type that evaluates a json schema into a type at compiletime. unlike other JSON schema to type converters, this one doesn't use any code generation! :o
a typescript utility type that evaluates a json schema into a type at compiletime. unlike other JSON schema to type converters, this one doesn't use any code generation! :o
type Foo = FromJsonSchema<{
type: 'object'
properties: {
foo: {
type: 'object'
properties: {
asdf: {
type: 'string'
}
}
additionalProperties: false
}
bar: {
type: 'array'
items: {
type: 'string'
}
}
}
additionalProperties: false
}>
// Type '{}' is missing the following properties from type '{ foo: { asdf: string; }; bar: string[]; }': foo, bar
const foo: Foo = {}