Skip to content

适用于 Serein 的 JavaScript 插件的 TypeScript 辅助库

License

Notifications You must be signed in to change notification settings

SereinDev/HelperLib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HelperLib

  • 适用于 SereinJavaScript插件的 TypeScript类型声明库
  • 当前适用版本 2.0.0

使用方法

Tip

你可以直接使用Js/Ts模板创建仓库

建议使用Visual Studio Code或其他带有语法提示的代码编辑器编写插件

1. 下载/克隆/拉取代码到本地

git clone https://github.com/SereinDev/HelperLib.git

# or

git submodule add https://github.com/SereinDev/HelperLib.git

2. 添加引用

单个文件

在文件开头加上如下两行

// @ts-check
/// <reference path="path/to/lib/HelperLib/src/index.d.ts"/>

TypeScript项目

修改tsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "lib": [
      "ES2023",
    ],
    "skipLibCheck": true,
    // 👇👇👇
    "typeRoots": [
      "path/to/lib//HelperLib/src/*.ts"
    ],
    // 👆👆👆
  },
}

JavaScript项目

修改jsconfig.json

{
  "compilerOptions": {
    "target": "esnext",
    "lib": [
      "ES2023",
    ],
    "skipLibCheck": true,
    // 👇👇👇
    "typeRoots": [
      "path/to/lib//HelperLib/src/*.ts"
    ],
    // 👆👆👆
  },
}

3. 开始编写你的插件

如果你输入serein后出现了和下面一样的语法提示,就说明你添加成功了

serein
      ┌───────────────────────────────────────────┐
      [] serein   const serein: ScriptInstance  
      └───────────────────────────────────────────┘

About

适用于 Serein 的 JavaScript 插件的 TypeScript 辅助库

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published