figma/plugin-typings

BooleaOperation is missing constraint peoperty (from ConstaintMixin)

softmarshmallow opened this issue · 3 comments

this must be

 interface BooleanOperationNode extends DefaultShapeMixin, ChildrenMixin, CornerMixin {
    readonly type: "BOOLEAN_OPERATION"
    clone(): BooleanOperationNode
    booleanOperation: "UNION" | "INTERSECT" | "SUBTRACT" | "EXCLUDE"

    expanded: boolean
  }
export interface BooleanOperationNode
  extends DefaultShapeMixin,
    ChildrenMixin,
    // CUSTOM OVERRIDE
    // ---- this is not from official plugin typings, but exists. ---
    ConstraintMixin,
    // --------------------------------------------------------------
    CornerMixin {
  readonly type: "BOOLEAN_OPERATION";
  clone(): BooleanOperationNode;
  booleanOperation: "UNION" | "INTERSECT" | "SUBTRACT" | "EXCLUDE";

  expanded: boolean;
}

the constraint property exists on remote api

Boolean operations should not have a constraints field. I did a check in the console and they do not have constraints set on them. Going to close out, but please re-open if you are seeing that boolean operation nodes are being returned with a constraints field. Thanks!

But it does have constraint on remote api definitions. BooleanOperation implements VECTOR.
https://www.figma.com/developers/api#vector-props

I don't know about why the REST API is like this but the Plugins API closely matches the internal nodes structure of the editor. Booleans are technically similar to groups, and both don't have the constraints property. When you select a group or a boolean in the editor, it shows the constraints of the objects nested in the group, not the group itself (because, again, group doesn't have its own constraints, and it can't exist without objects inside).