Hello all,
I have this typescript error, but i am not sure what is mean, and how to resolve it. Any help would be appreciated. Thanks
Hello all,
I have this typescript error, but i am not sure what is mean, and how to resolve it. Any help would be appreciated. Thanks
Best answer by ntfromchicago
Ah, thanks for the clarification. The good news is that if your code works, it’s fine. That’s because your TypeScript gets compiled into JavaScript. So the error you see doesn’t exist in JS.
TypeScript is designed for syntax and type checking, so that warning appears because it thinks you are sending it a BaseStyle
but you know (correctly) that it’s a TextStyle
.
To make this error go away, just cast it explicitly as a TextStyle
, e.g.
const aTextStyleFontFamily = (figma.getStyleById(id) as TextStyle).fontName.family
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.