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

1.0.0

Type parameters

  • A

  • O = A

  • I = unknown

Hierarchy

Implements

  • Decoder<I, A>
  • Encoder<A, O>

Index

Constructors

  • new Type<A, O, I>(name: string, is: Is<A>, validate: Validate<I, A>, encode: Encode<A, O>): Type<A, O, I>
  • Type parameters

    • A

    • O = A

    • I = unknown

    Parameters

    • name: string
    • is: Is<A>
    • validate: Validate<I, A>
    • encode: Encode<A, O>

    Returns Type<A, O, I>

Properties

_A: A
since

1.0.0

_I: I
since

1.0.0

_O: O
since

1.0.0

encode: Encode<A, O>

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

is: Is<A>

a custom type guard

name: string

a unique name for this codec

validate: Validate<I, A>

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

Methods

  • asDecoder(): Decoder<I, A>
  • since

    1.0.0

    Returns Decoder<I, A>

  • asEncoder(): Encoder<A, O>
  • since

    1.0.0

    Returns Encoder<A, O>

  • decode(i: I): Validation<A>
  • a version of validate with a default context

    since

    1.0.0

    Parameters

    • i: I

    Returns Validation<A>

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

    1.0.0

    Type parameters

    • B

    • IB

    • A

    • OB

    Parameters

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

    Returns Type<B, O, I>

Generated using TypeDoc