Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

  • Type<T["_A"] | undefined, T["_O"] | undefined, T["_I"] | undefined>
    • OptionalType

Index

Constructors

  • new OptionalType<T>(type: T, name?: string): OptionalType<T>

Properties

_A: undefined | T["_A"]
since

1.0.0

_I: undefined | T["_I"]
since

1.0.0

_O: undefined | T["_O"]
since

1.0.0

encode: Encode<undefined | T["_A"], undefined | T["_O"]>

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

is: Is<undefined | T["_A"]>

a custom type guard

name: string

a unique name for this codec

type: T
validate: Validate<undefined | T["_I"], undefined | T["_A"]>

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

Methods

  • asDecoder(): Decoder<undefined | T["_I"], undefined | T["_A"]>
  • since

    1.0.0

    Returns Decoder<undefined | T["_I"], undefined | T["_A"]>

  • asEncoder(): Encoder<undefined | T["_A"], undefined | T["_O"]>
  • since

    1.0.0

    Returns Encoder<undefined | T["_A"], undefined | T["_O"]>

  • decode(i: undefined | T["_I"]): Validation<undefined | T["_A"]>
  • a version of validate with a default context

    since

    1.0.0

    Parameters

    • i: undefined | T["_I"]

    Returns Validation<undefined | T["_A"]>

  • pipe<B, IB, A, OB>(ab: Type<B, OB, IB>, name?: string): Type<B, undefined | T["_O"], undefined | T["_I"]>
  • since

    1.0.0

    Type parameters

    • B

    • IB

    • A

    • OB

    Parameters

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

    Returns Type<B, undefined | T["_O"], undefined | T["_I"]>

Generated using TypeDoc