@figma/widget-typings

中文文档
1.13.0发布于 2026/08/07MIT LicenseTypeScript零依赖近 30 天下载 3.4万

Typings for the Figma Widget API

原始使用文档

Figma Widget API typings

npm

This repository contains the typings for the Figma Widget API.

Usage

  1. Installation

    Note that the widget api is an extention of the plugin api so you should install both @figma/plugin-typings and @figma/widget-typings

    npm i --save-dev @figma/plugin-typings @figma/widget-typings
    
  2. Configure tsconfig.json

    {
        "compilerOptions": {
            "typeRoots": [
                "./node_modules/@types",
                "./node_modules/@figma"
            ]
        }
    }
    

The configuration above is needed for the TypeScript compiler to use type definitions found in both ./node_modules/@types and ./node_modules/@figma. Normally, most external type definitions are from DefinitelyTyped and are installed in /@types, which included by TypeScript by default. Since we host the plugin & widget typings separately, they are installed outside in /@figma instead.

Types should become globally available without needing to use import statements. We do it this way because the widget API is part of the host environment, as opposed to being a package that a plugin includes.

About

Widget API releases have the format "Version X, Update Y". Equivalent tags are created in this repository as v<x>.<y>. Note that not all API releases include API changes, some are just bug fixes. Therefore, some typings versions are skipped.

版本与发布记录

@figma/widget-typings 共发布 19 个版本,首次发布于 2021/10/07;过去 12 个月发布了 1 个版本。

版本发布日期距今
1.13.0latest2026/08/073 个月前
1.12.12025/10/021.1 年前
1.12.02025/06/141.4 年前
1.11.02024/12/201.9 年前
1.9.22024/09/172 年前
1.9.12023/09/273 年前

关于 @figma/widget-typings 的常见问题

@figma/widget-typings 是什么?

Typings for the Figma Widget API

如何安装 @figma/widget-typings?

在项目目录运行 npm install @figma/widget-typings,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:@figma/plugin-typings(1.x)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@figma/widget-typings 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@figma/widget-typings 可以商用吗?

@figma/widget-typings 使用 MIT License 许可。声明的许可为 MIT License,请阅读许可原文确认使用条件。以上为概括,不构成法律意见,请以许可原文为准。

@figma/widget-typings 的下载量有多少?

根据 npm 官方下载统计,@figma/widget-typings 在 2026/10/15 – 2026/11/13 这 30 天内被下载 34,183 次,日均约 1,139 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@figma/widget-typings 还在维护吗?

最新版本 1.13.0 发布于 2026/08/07(3 个月前);至今共发布 19 个版本,其中过去 12 个月发布了 1 个;首次发布于 2021/10/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。