🚀. Socket Launch Week Day 3:Socket Firewall Now Blocks Malicious VS Code and Open VSX Extensions.Learn more
Sign In

wps-airscript-types

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

wps-airscript-types

WPS AirScript Api TypeScript类型申明, 包含v1.0和v2.0

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

wps-airscript-types

WPS Airscript TypeScript类型定义。以便在IDE中可以使用代码提示。
非官方项目,但是从金山文档网页中的源代码解析生成,使用方法与官方文档一致。

官方文档:AirScript文档

安装

npm install wps-airscript-types

使用

在你的项目根目录下新建airscript.d.ts文件,内容如下:

/// <reference path="./node_modules/wps-airscript-types/types/Context.d.ts" />

/// <reference path="./node_modules/wps-airscript-types/types/ApiV1.d.ts" />

如果你需要使用V2版本的API,只需要将ApiV1.d.ts替换为ApiV2.d.ts即可。

配置tsconfig.json文件,添加include值:

{
    "include": ["airscript.d.ts"],
}

然后就可以在代码中使用类型声明和代码提示了。

ide

如何提取最新类型定义

source

如图,以多维表为例。

  • 打开金山文档网页版多维表或者智能表格编辑页。
  • 打开AirScript脚本编辑器,进入脚本编辑模式。
  • 打开浏览器控制台,在Sources选项卡中,在db_script_ide下面搜寻类型定义代码,如图中的文件名是468.70fb31cf.js,随着wps的更新,文件名可能会变,需要自己逐个排查。
  • 复制特定区块代码,如图中选中颜色区所示,注意开头和结尾,将其放入该项目的source.txt中。
  • 运行npm run build,即可在types文件夹下生成v1和v2版本的类型定义,可将其复制到自己的项目中。

Keywords

wps

FAQs

Package last updated on 28 Feb 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts