Search


Search something to see results

Map

Type Parameters

  • T extends Map<PropertyKey, any>
  • Input = unknown

Parameters

Returns MapSchema<T, Input>

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' }