Figma Plugin API Typings

repository·master·Indexed 42 days ago

https://github.com/figma/plugin-typings

Official TypeScript type definitions for the Figma Plugin API (version 1.138.0), providing type safety and autocompletion for plugin development.

Tokens
269
Snippets
2
Records
2
Agent score
4%

What's inside Figma Plugin API

  1. Configure tsconfig.json for Figma typings

    master

    Because Figma plugin typings are installed in ./node_modules/@figma rather than the standard ./node_modules/@types directory, you must update your tsconfig.json to include the @figma path in typeRoots. This ensures the TypeScript compiler can locate the definitions. Once configured, the Figma API types will be globally available without requiring explicit import statements, reflecting how the API exists in the Figma host environment.

    {
        "compilerOptions": {
            "typeRoots": [
                "./node_modules/@types",
                "./node_modules/@figma"
            ]
        }
    }
  2. Install @figma/plugin-typings

    master

    Install the Figma Plugin API typings as a development dependency using npm or yarn to enable TypeScript support for Figma plugin development.

    npm i --save-dev @figma/plugin-typings
    # or
    yarn add -D @figma/plugin-typings