Since

1.0.0

Type Parameters

  • V extends LiteralValue

Hierarchy

  • Type<V>
    • LiteralType

Constructors

  • Type Parameters

    • V extends 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

  • Since

    1.0.0

    Returns Decoder<unknown, V>

  • Since

    1.0.0

    Returns Encoder<V, V>

  • a version of validate with a default context

    Since

    1.0.0

    Parameters

    • i: unknown

    Returns Validation<V>

  • Since

    1.0.0

    Type Parameters

    • B

    • IB

    • A

    • OB

    Parameters

    • this: Type<A, V, unknown>
    • ab: Type<B, OB, IB>
    • Optional name: string

    Returns Type<B, V, unknown>

Generated using TypeDoc