Getting Started

Next, install TypeScript using the command:

npm install -g typescript

if you get a permission error try the command with sudo.

Finally, in the directory of your plugin, get the latest type definitions for the plugin API by running:

npm install --save-dev @figma/plugin-typings

Using TypeScript requires a compiler to convert TypeScript (code.ts) into JavaScript (code.js) for the browser to run.

We recommend writing TypeScript code using Visual Studio code:

  1. Open project directory in Visual Studio Code.
  2. Compile TypeScript to JavaScript: Run the “Terminal > Run Build Task…” menu item, then select “npm: watch”. You will have to do this again every time you reopen Visual Studio Code.

Hot reloading Figma provides the option to hot reload your plugin to speed up the development process. As you edit the plugin code and rebuild, the plugin will automatically restart with the latest changes. If turned off, you will need to manually restart the plugin.

plugins > Development >hot reload plugins