ACP v2 TypeScript SDK — EXPERIMENTAL DRAFT - v1.3.0
    Preparing search index...

    Variable DiffChangeExperimental

    DiffChange: {
        isAdd(
            value: DiffChange,
        ): value is DiffPathChange & { operation: "add" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
        isDelete(
            value: DiffChange,
        ): value is DiffPathChange & { operation: "delete" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
        isModify(
            value: DiffChange,
        ): value is DiffPathChange & { operation: "modify" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
        isMove(
            value: DiffChange,
        ): value is DiffPathPairChange & { operation: "move" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
        isCopy(
            value: DiffChange,
        ): value is DiffPathPairChange & { operation: "copy" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
        isCustom(
            value: DiffChange,
        ): value is { operation: string; [key: string]: unknown } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >;
    }

    Validated type guards for DiffChange's known variants.

    Each guard validates the variant's payload, not just its discriminant tag: a malformed known variant (right tag, wrong payload) matches no guard — mirroring wire validation, which rejects such values instead of classifying them as custom.

    Guards check the value as given: fields that wire deserialization salvages to a default (e.g. a malformed _meta) are only normalized by parsing, and for ambiguous raw shapes (a known tag combined with another variant's payload) guards are conservative where wire parsing may still accept the value — narrow wire-parsed values when exact parity matters.

    Type Declaration

    • isAdd: function
      • Narrow to the add variant, validating its payload.

        Parameters

        • value: DiffChange

        Returns value is DiffPathChange & { operation: "add" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >

    • isDelete: function
      • Narrow to the delete variant, validating its payload.

        Parameters

        • value: DiffChange

        Returns value is DiffPathChange & { operation: "delete" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >

    • isModify: function
      • Narrow to the modify variant, validating its payload.

        Parameters

        • value: DiffChange

        Returns value is DiffPathChange & { operation: "modify" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >

    • isMove: function
      • Narrow to the move variant, validating its payload.

        Parameters

        • value: DiffChange

        Returns value is DiffPathPairChange & { operation: "move" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >

    • isCopy: function
      • Narrow to the copy variant, validating its payload.

        Parameters

        • value: DiffChange

        Returns value is DiffPathPairChange & { operation: "copy" } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >

    • isCustom: function
      • Narrow to a custom or future variant: the operation tag matches no known variant.

        TypeScript keeps the known variants in the narrowed union (they are structural subtypes of the catch-all), so read vendor payload keys via a widening cast: (value as Record<string, unknown>).someKey.

        Parameters

        • value: DiffChange

        Returns value is { operation: string; [key: string]: unknown } & Pick<
            DiffChange,
            "_meta"
            | "mimeType"
            | "fileType",
        >