Hello,
I am trying to apply grid variable using below code by following Working with Variables | Plugin API guide.
Error : Expected “layoutPattern” to have type “GRID” but got string instead
We are trying to create a copy of layoutgrid and apply new variable using below code
let propCopy = p...node.layoutGrids];
propCopyp0] = figma.variables.setBoundVariableForLayoutGrid(
propCopyp0],
"gutterSize",
variable
);
node.layoutGrids = propCopy;
propCopyp0] is as below
{alignment: "STRETCH",
boundVariables: {offset: {…}, sectionSize: {…}, count: {…}, gutterSize: {…}},
color: {r: 1, g: 0, b: 0, a: 0.10000000149011612},
count: 4,
gutterSize: 20,
offset: 100,
pattern: "ROWS",
visible: true}
But after executing, we are getting below error:
in setBoundVariableForLayoutGrid: Expected "layout…ttern" to have type "GRID" but got string instead
mesage: "in setBoundVariableForLayoutGrid: Expected "layoutGridCopy" to be one of the following, but none matched: \n Expected "layoutGridCopy.alignment" to be one of the following, but none matched: \n Expected "layoutGridCopy.alignment" to have type "MIN" but got string instead\n Expected "layoutGridCopy.alignment" to have type "MAX" but got string instead\n Expected "layoutGridCopy.boundVariables" to have type {gutterSize: (optional) {id: string, type: "VARIABLE_ALIAS"}, count: (optional) {id: string, type: "VARIABLE_ALIAS"}, offset: (optional) {id: string, type: "VARIABLE_ALIAS"}} but got additional property "sectionSize"\n Expected "layoutGridCopy.alignment" to have type "CENTER" but got string instead\n Expected "layoutGridCopy.pattern" to have type "GRID" but got string instead"
Please help.
Thank you