plugin-typings icon indicating copy to clipboard operation
plugin-typings copied to clipboard

TS2339: Property 'colors' does not exist on type 'ConstantsAPI' in Figma Plugin API

Open mikhin opened this issue 1 year ago • 2 comments

I'm working on a Figma plugin using the Figma Plugin API and TypeScript. I'm trying to access the figma.constants.colors object to get the FigJam base colors, but I'm encountering a TypeScript error.

Here's the code snippet that's causing the issue:

console.log(figma.constants.colors.figJamBase);

The error message I'm getting is:

TS2339: Property 'colors' does not exist on type 'ConstantsAPI'.

According to the Figma Plugin API documentation, the figma.constants.colors object should provide a set of color palettes, including figJamBase and figJamBaseLight, which map the names of all the FigJam base and light colors to their corresponding hex values.

I'm not sure why I'm getting this error. Any help would be appreciated.

mikhin avatar Mar 13 '24 15:03 mikhin

oh, I think I got the repository wrong, this should probably have been posted here - https://github.com/figma/widget-typings

mikhin avatar Mar 14 '24 07:03 mikhin

Hi! This definitely seems to be incorrect in our typings file. You should be able to use figma.constants.colors.figJamBase safely, and we will update the typings so that they are correct!

efrankenbergfigma avatar Mar 15 '24 18:03 efrankenbergfigma