Type Magic: validation on type property
How to validate defs in object type properties?
I did that three days ago but I forgot how
I did that three days ago but I forgot how
export type validateSchema<
def,
schema,
> = {
[K in keyof schema]:
K extends keyof def
? validateTypeRoot<def[K]>
: validateTypeRoot<unknown>
}
function test<const def>(
def: validateSchema<def, { a: 1 }>,
) { }
test({
a: 'str',
})