Installations
npm install @qiushaocloud-types/qtypings-nodejs-global
Developer Guide
BETA
Typescript
Yes
Module System
N/A
Node Version
18.18.2
NPM Version
9.6.6
Score
65.7
Supply Chain
88
Quality
75.6
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Total Downloads
Cumulative downloads
Total Downloads
699
Last day
-70%
3
Compared to previous day
Last week
-15.4%
11
Compared to previous week
Last month
250%
35
Compared to previous month
Last year
-57.6%
208
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Versions
NodeJS 环境定义一些全局接口、类型等
项目源码
- 自建 gitlab 地址: https://gitlab.qiushaocloud.top/qiushaocloud/npmjs-dts-types-projects
- github 地址: https://github.com/qiushaocloud/npmjs-dts-types-projects
npm 包
tsconfig.json
引入 @qiushaocloud-types/qtypings-nodejs-global:tsconfig.json
中需要配置"files":["node_modules/@qiushaocloud-types/qtypings-nodejs-global/index.d.ts"]
- 安装 npm 包:
npm install --save-dev @qiushaocloud-types/qtypings-nodejs-global
TS 定义
nodejs.d.ts
1declare namespace NodeJS { 2 interface Global { 3 [propName: string]: any; 4 } 5}
object.d.ts
1declare type QJson = Record<string, any>; 2 3declare type QJsonT<T> = Record<string, T>; 4 5declare type QJsonNumber = Record<number, any> 6 7declare type QJsonNumberT<T> = Record<number, T>;
fn.d.ts
1/** 任意回调参数的回调函数 */ 2declare interface QFnAnyArgs{ 3 (... args:any[]):void; 4} 5 6/** 无回调参数的回调函数 */ 7declare interface QFnEmptyArgs{ 8 ():void; 9} 10 11/** 任意回调参数的回调函数, 返回类型T */ 12declare interface QFnAnyArgsReturnT<T>{ 13 (... args:any[]): T; 14} 15 16/** 是否成功回调函数 */ 17declare interface QFnIsSuccess{ 18 (isSuccess: boolean):void; 19} 20 21/** 是否成功回调函数, 第2个参数开始任意回调参数*/ 22declare interface QFnIsSuccessAnyArgs{ 23 (isSuccess: boolean, ...args: any[]):void; 24} 25 26/** 错误则无result,有result则无错误 */ 27declare interface QFnErrorOrResult{ 28 (err: Error | any | void, result?: any, ...args: any[]): void; 29} 30 31/** 错误描述回调 */ 32declare interface QFnErrorDesc{ 33 (errDesc: string): void; 34}
开源不易,如果对您有帮助,请您动一动您的小手,给作者点 Star,也请您多多关注分享者「邱少羽梦」
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No vulnerabilities found.
![Empty State](/_next/static/media/empty.e5fae2e5.png)
No security vulnerabilities found.