Type alias Difference<Value>

Difference<Value>: {
    error?: unknown;
    index?: number;
    item?: Difference<Value>;
    kind: "A" | "D" | "E" | "N" | "X";
    lhs?: Value;
    path?: ReadOnlyArray<string>;
    rhs?: Value;
}

Difference object from deep-diff, with some customizations on top.

Example

const difference: Difference<string> = {
kind: "E",
path: ["🟢", "🟩"],
lhs: "🟢",
rhs: "🟩",
};

Type Parameters

  • Value = unknown

Type declaration

  • Optional Readonly error?: unknown

    Only has a value when kind is X.

  • Optional Readonly index?: number

    Indicates the array index where the change occurred (kind A).

  • Optional Readonly item?: Difference<Value>

    Contains a nested change record indicating the change that occurred at the array index (kind A).

  • Readonly kind: "A" | "D" | "E" | "N" | "X"

    Indicates the kind of change.

  • Optional Readonly lhs?: Value

    The value on the left-hand-side of the comparison (undefined for kind N).

  • Optional Readonly path?: ReadOnlyArray<string>

    The property path.

  • Optional Readonly rhs?: Value

    The value on the right-hand-side of the comparison (undefined for kind D).