record<Key extends PropertyKey, Value, Input = unknown>( key: Schema<Key, unknown>, value: Schema<Value, unknown>,): RecordSchema<Key, Value, Input>
key: Schema<Key, unknown>
value: Schema<Value, unknown>
import * as x from 'unhoax'// Type-Driventype MyRecord = Record<string, number>const schema = x.record<MyRecord>(x.string, x.number)// Infer-Drivenconst schema = x.record(x.string, x.number)type MyRecord = x.TypeOf<typeof schema>schema.parse({ hello: 42 }) // { success: true, value: { hello: 42 } } Copy
import * as x from 'unhoax'// Type-Driventype MyRecord = Record<string, number>const schema = x.record<MyRecord>(x.string, x.number)// Infer-Drivenconst schema = x.record(x.string, x.number)type MyRecord = x.TypeOf<typeof schema>schema.parse({ hello: 42 }) // { success: true, value: { hello: 42 } }
See
Example