Hi, I’m about to playing around with plugin development in Figma. I tried to change the value of a textNode on click. The values are stored in a simple array.
So I have an array and a random calc to replace the textNode with other values if button is hit again:
var names = ["John", "Elias", "Mark", "Robert", "Niels", "Andrea"];
var randomItem = names[Math.floor(Math.random() * names.length)];
First of all: Thank you for your help
When I tried to implement / change it, It gave me an error in fontName. But it worked partially.
However, even if I reuse the above code, I can’t run the plugin anymore.
I get the error:
let selection: TextNode
Argument of type 'FontName | unique symbol' is not assignable to parameter of type 'FontName'.
Type 'typeof figma.mixed' is not assignable to type 'FontName'.ts(2345)
I googled for a solution but I can’t find any.
I also tried a for loop to change multiple textNodes e.g for (const node of figma.currentPage.selection)
Did not work.
Any clue why this is? I also got the latest typings…