Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface DocumentIoType<T>

Type parameters

  • T

Hierarchy

Index

Properties

Optional changeCase

changeCase: CaseStyle

The keys of the serialized documents are renamed following the supplied style (undefined to keep the original name).

Optional name

name: undefined | string

Name of this type. This is only used to help with debugging.

Optional noExtraKeys

noExtraKeys: undefined | false | true

Treat values with extra keys as invalid.

properties

properties: object

Type declaration

Optional rename

rename: undefined | object

Methods

clone

  • clone(value: T): T
  • Returns a deep copy of value.

    Parameters

    • value: T

      The value to clone, trusted to be compatible with this type.

    Returns T

    A deep copy of the supplied value, restricted to the properties of this type.

diff

  • diff(oldVal: T, newVal: T): Diff<T> | undefined
  • Returns undefined if both values are equivalent, otherwise a diff representing the change from oldVal to newVal.

    Parameters

    • oldVal: T

      The old value

    • newVal: T

      The new value

    Returns Diff<T> | undefined

equals

  • equals(left: T, right: T): boolean
  • Tests if left is equal to value.

    This is a deep strict structural equality test restricted to the properties of this type.

    It satisfies the following properties (the variables a, b and c are valid values):

    • Reflexivity: type.equal(a, a) === true
    • Symmetry: type.equals(a, b) === type.equals(b, a)
    • Transitivity: if type.equals(a, b) && type.equals(b, c) then type.equals(a, c)

    The above properties mean that type objects implement the Setoid algebra as specified by Static Land.

    see

    https://github.com/rpominov/static-land/blob/master/docs/spec.md#setoid

    Parameters

    • left: T

      Left value, trusted to be compatible with this type.

    • right: T

      Right value, trusted to be compatible with this type.

    Returns boolean

    Boolean indicating if both values are equal.

getOutKey

  • getOutKey(key: keyof T): string

Optional lte

  • lte(left: T, right: T): boolean
  • Compares two valid values.

    Parameters

    • left: T

      Left operand, a valid value.

    • right: T

      Right operand, a valid value.

    Returns boolean

    Boolean indicating if left <= right is true.

patch

  • patch(oldVal: T, diff: Diff<T> | undefined): T

read

  • read<R>(reader: Reader<R>, raw: R): T

reverseDiff

  • reverseDiff(diff: Diff<T> | undefined): Diff<T> | undefined

squash

  • squash(oldDiff: Diff<T> | undefined, newDiff: Diff<T> | undefined): Diff<T> | undefined

test

  • test(value: T): boolean
  • Tests if this type matches value.

    Parameters

    • value: T

      The value to test against this type.

    Returns boolean

    Boolean indicating if this type matches value.

Optional testError

  • testError(value: T): Error | undefined
  • Tests if this type matches value, describes the error if not.

    Parameters

    • value: T

      The value to test against this type.

    Returns Error | undefined

    If this type matches value then undefined; otherwise an error describing why this type does not match value.

write

  • write<W>(writer: Writer<W>, value: T): W

Generated using TypeDoc