- 适用于 Serein的
JavaScript
插件的TypeScript
类型声明库 - 当前适用版本
2.0.0
建议使用Visual Studio Code或其他带有语法提示的代码编辑器编写插件
git clone https://github.com/SereinDev/HelperLib.git
# or
git submodule add https://github.com/SereinDev/HelperLib.git
在文件开头加上如下两行
// @ts-check
/// <reference path="path/to/lib/HelperLib/src/index.d.ts"/>
修改tsconfig.json
{
"compilerOptions": {
"target": "esnext",
"lib": [
"ES2023",
],
"skipLibCheck": true,
// 👇👇👇
"typeRoots": [
"path/to/lib//HelperLib/src/*.ts"
],
// 👆👆👆
},
}
修改jsconfig.json
{
"compilerOptions": {
"target": "esnext",
"lib": [
"ES2023",
],
"skipLibCheck": true,
// 👇👇👇
"typeRoots": [
"path/to/lib//HelperLib/src/*.ts"
],
// 👆👆👆
},
}
如果你输入serein
后出现了和下面一样的语法提示,就说明你添加成功了
serein
┌───────────────────────────────────────────┐
│[◻] serein const serein: ScriptInstance │
└───────────────────────────────────────────┘