Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

Hierarchy

  • Type<T["_A"], T["_O"], T["_I"]>
    • DefaultedType

Index

Constructors

  • new DefaultedType<T>(type: T, defaultValue: T["_A"], name?: string): DefaultedType<T>

Properties

_A: T["_A"]
since

1.0.0

_I: T["_I"]
since

1.0.0

_O: T["_O"]
since

1.0.0

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

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

is: Is<T["_A"]>

a custom type guard

name: string

a unique name for this codec

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

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

Methods

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

    1.0.0

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

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

    1.0.0

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

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

    since

    1.0.0

    Parameters

    • i: T["_I"]

    Returns Validation<T["_A"]>

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

    1.0.0

    Type parameters

    • B

    • IB

    • A

    • OB

    Parameters

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

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

Generated using TypeDoc