Map<T extends Map<PropertyKey, any>, Input = unknown>( key: Schema<MapKey<T>>, value: Schema<MapValue<T>>,): MapSchema<T, Input>
key: Schema<MapKey<T>>
value: Schema<MapValue<T>>
import { x } from 'unhoax'const nameByIdSchema = x.Map(x.number, x.string)const input = new Map([[1, 'Jack'], [2, 'Mary']])const result = nameByIdSchema.parse(input)// { success: true, value: Map { 1 => 'Jack', 2 => 'Mary' } } Copy
import { x } from 'unhoax'const nameByIdSchema = x.Map(x.number, x.string)const input = new Map([[1, 'Jack'], [2, 'Mary']])const result = nameByIdSchema.parse(input)// { success: true, value: Map { 1 => 'Jack', 2 => 'Mary' } }
See
Example