Options
All
  • Public
  • Public/Protected
  • All
Menu
since

1.0.0

Type parameters

  • V: LiteralValue

Hierarchy

Index

Constructors

  • new LiteralType<V>(name: string, is: Is<V>, validate: Validate<unknown, V>, encode: Encode<V, V>, value: V): LiteralType<V>
  • Type parameters

    • V: LiteralValue

    Parameters

    • name: string
    • is: Is<V>
    • validate: Validate<unknown, V>
    • encode: Encode<V, V>
    • value: V

    Returns LiteralType<V>

Properties

_A: V
since

1.0.0

_I: unknown
since

1.0.0

_O: V
since

1.0.0

_tag: "LiteralType"
since

1.0.0

encode: Encode<V, V>

converts a value of type A to a value of type O

is: Is<V>

a custom type guard

name: string

a unique name for this codec

validate: Validate<unknown, V>

succeeds if a value of type I can be decoded to a value of type A

value: V

Methods

  • asDecoder(): Decoder<unknown, V>
  • since

    1.0.0

    Returns Decoder<unknown, V>

  • asEncoder(): Encoder<V, V>
  • decode(i: unknown): Validation<V>
  • a version of validate with a default context

    since

    1.0.0

    Parameters

    • i: unknown

    Returns Validation<V>

  • pipe<B, IB, A, OB>(ab: Type<B, OB, IB>, name?: string): Type<B, V, unknown>
  • since

    1.0.0

    Type parameters

    • B

    • IB

    • A

    • OB

    Parameters

    • ab: Type<B, OB, IB>
    • Optional name: string

    Returns Type<B, V, unknown>

Generated using TypeDoc