[脚本猫开发指南]jQuery自动提示
为了方便开发,脚本猫提供了识别`.d.ts`文件的自动提示功能:[描述文档 #definition](https://docs.scriptcat.org/dev/meta.html#definition)以jQuery为例,从(https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jquery)项目中找到jQuery相关的`.d.ts`文件,然后在脚本的`UserScript`中,添加`@definition`声明,保存代码后会自动添加`.d.ts`声明文件进入编辑器
需要添加以下几个`.d.ts`文件,其它的库使用方法类似。值得注意的是,因为来源是github,所以可能会卡顿,保存一段时间后才会生效,可以f12查看network中的加载状况。
```javascript
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @definition https://github.com/DefinitelyTyped/DefinitelyTyped/raw/master/types/jquery/index.d.ts
// @definition https://github.com/DefinitelyTyped/DefinitelyTyped/raw/master/types/jquery/JQuery.d.ts
// @definition https://github.com/DefinitelyTyped/DefinitelyTyped/raw/master/types/jquery/JQueryStatic.d.ts
// @definition https://github.com/DefinitelyTyped/DefinitelyTyped/raw/master/types/jquery/misc.d.ts
// @definition https://github.com/DefinitelyTyped/DefinitelyTyped/raw/master/types/jquery/legacy.d.ts
```

技能树点歪了、、、 maxzhang 发表于 2021-10-9 10:51
技能树点歪了、、、
怎么说?哥哥,觉得还挺方便的 王一之 发表于 2021-10-9 10:52
怎么说?哥哥,觉得还挺方便的
ggnb
页:
[1]