Type alias TypedObject<T, C>

TypedObject<T, C>: {
    arrayType?: TypedObject<T extends (infer E)[]
        ? E
        : T, C>;
    getSubType?: ((value) => TypedObject<any, C>);
    merge?: ((update, original, template, context) => Partial<T> | null);
    properties?: TypedProperties<T, C>;
    shorthand?: ((shorthand, context) => Partial<T> | null);
    unwrap?: ((update, template, context) => T);
    wrap?: ((update, template, context) => T);
}

TypedObject is a metadata entry that enabled traversing.

Type Parameters

  • T
  • C

Type declaration

  • Optional arrayType?: TypedObject<T extends (infer E)[]
        ? E
        : T, C>

    If the type is an array it can have an arrayType. This should only be defined if the current TypeObject is an array. This would be the un-arrayed type

  • Optional getSubType?: ((value) => TypedObject<any, C>)

    Allows for a sub type to be defined based on the value.

    Returns

  • Optional merge?: ((update, original, template, context) => Partial<T> | null)

    Return a new T that is the result of merging the update into the original. If this is not defined then the default merging logic will be applied

      • (update, original, template, context): Partial<T> | null
      • Parameters

        • update: T | ((original) => T)
        • original: T | undefined
        • template: T
        • context: C

        Returns Partial<T> | null

  • Optional properties?: TypedProperties<T, C>

    Define the properties that are available.

  • Optional shorthand?: ((shorthand, context) => Partial<T> | null)

    Return null if shorthand is not understood.

      • (shorthand, context): Partial<T> | null
      • Parameters

        • shorthand: T | string
        • context: C

        Returns Partial<T> | null

  • Optional unwrap?: ((update, template, context) => T)
      • (update, template, context): T
      • Parameters

        • update: T
        • template: T
        • context: C

        Returns T

  • Optional wrap?: ((update, template, context) => T)
      • (update, template, context): T
      • Parameters

        • update: T
        • template: T
        • context: C

        Returns T

Remarks

If a type has properties defined and is an Object then it will be traversed. If a type has arrayType defined and is an Array then it will be traversed.