figma / plugin-typings

Typings for the Figma Plugin API
MIT License
195 stars 45 forks source link

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

Closed mikhin closed 5 months ago

mikhin commented 7 months ago

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 commented 7 months ago

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

efrankenbergfigma commented 7 months ago

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!