Sanity Library Reference Docs
    Preparing search index...

    Type Alias CollaborationCommentTargetAlpha

    CollaborationCommentTarget: {
        documentId: string;
        documentRevisionId?: string;
        documentType: string;
    } & (
        | {
            anchor: CollaborationCommentAnchor;
            fieldValue?: never;
            path: string;
            range?: never;
        }
        | {
            anchor?: never;
            fieldValue?: CollaborationCommentFieldValue;
            path: string;
            range: CollaborationCommentRange;
        }
        | { anchor?: never; fieldValue?: never; path?: string; range?: never }
    )

    Target for a top-level comment. Inline selections require both path and anchor; field-level comments may set path alone.

    The created comment stores this in a different shape: path becomes target.path.field, and anchor is resolved against the document into target.path.selection and contentSnapshot rather than being stored.

    Deprecated range + top-level fieldValue are still accepted and converted to a portable-text anchor before the request is sent.

    Type declaration

    • documentId: string
    • OptionaldocumentRevisionId?: string
    • documentType: string
    • {
          anchor: CollaborationCommentAnchor;
          fieldValue?: never;
          path: string;
          range?: never;
      }
      • anchor: CollaborationCommentAnchor
      • OptionalfieldValue?: never

        Use anchor.fieldValue.

      • path: string

        Path to the field containing the inline comment selection

      • Optionalrange?: never

        Use anchor.

    • {
          anchor?: never;
          fieldValue?: CollaborationCommentFieldValue;
          path: string;
          range: CollaborationCommentRange;
      }
      • Optionalanchor?: never
      • OptionalfieldValue?: CollaborationCommentFieldValue

        Portable Text covering the range. When set, the selection is resolved from these blocks instead of from the live document.

        Use anchor.fieldValue.

      • path: string

        Path to the field containing the inline comment selection

      • range: CollaborationCommentRange

        Use anchor.

    • { anchor?: never; fieldValue?: never; path?: string; range?: never }
      • Optionalanchor?: never
      • OptionalfieldValue?: never

        Use anchor.fieldValue.

      • Optionalpath?: string

        Path to the commented field

      • Optionalrange?: never

        Use anchor.