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