Open jimmymorris opened 3 months ago
Hi @jimmymorris! We are looking at how we can make string handling more flexible, thanks for providing another use case for us to look at.
I have this same question. I opened an issue here because I wasn't sure if it was supported.
In our case, we want to use the textContent from a layer and parse it as a number instead of a string. Something like:
value: figma.nestedProps("✏️ Value", {
number: parseInt(figma.textContent("✏️ Text")),
}),
but then we get the Unknown intrinsic
error.
What @jimmymorris mentioned would work too! Provided it also works for figma.textContent()
!
Something like:
value: figma.nestedProps("✏️ Value", {
number: figma.textContent("✏️ Text", (val:string) => Number(val)),
}),
Hey @ericandrewscott, unfortunately this is not supported right now. We are working on ways to improve flexibility here.
Describe the feature you'd like:
With some of our components the prop's type is number, but there is no option for us to transform the
figma.string
into a number. I feel like being able to do a callback likefigma.string('label', (val:string) => Number(val))
would be sufficient.