Search


Search something to see results

literal

Type Parameters

  • L extends [Literal, ...Literal[]]
  • Input = unknown

Parameters

  • literals: L

Returns LiteralSchema<L[number], Input>

import * as x from 'unhoax'

const schema = x.literal('a') // Schema<'a'>

const schema = x.literal('a', 42, true, null, undefined)
// Schema<'a' | 42 | true | null | undefined>