code-connect
code-connect copied to clipboard
Matching multiple enum values (variants)
Is there a way to match multiple enum values (variants)? Or, alternatively, set the default value for the property.
For example, I have a property "type" that has 3 possible values in Figma, "a", "b", and "c", but only 2 values in code, i.e. "x" and "y". Currently I have to repeat the same property mapping for "a" and "b":
someProp: figma.enum("type", {
a: x,
b: x,
c: y,
}
Is there a more efficient way to map "a" and "b" to the same code without repetitions? It would also work for me if I could explicitly set the code for "c", and then some default value that would apply to "a" and "b" by omission.