1.1.6 • Published 5 months ago

@qiushaocloud-types/qtypings-nodejs-global v1.1.6

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

NodeJS 环境定义一些全局接口、类型等

项目源码

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

declare namespace NodeJS {
    interface Global {
        [propName: string]: any;
    }
}

object.d.ts

declare type QJson = Record<string, any>;

declare type QJsonT<T> = Record<string, T>;

declare type QJsonNumber = Record<number, any>

declare type QJsonNumberT<T> = Record<number, T>;

fn.d.ts

/** 任意回调参数的回调函数 */
declare interface QFnAnyArgs{
    (... args:any[]):void;
}

/** 无回调参数的回调函数 */
declare interface QFnEmptyArgs{
    ():void;
}

/** 任意回调参数的回调函数, 返回类型T */
declare interface QFnAnyArgsReturnT<T>{
    (... args:any[]): T;
}

/** 是否成功回调函数 */
declare interface QFnIsSuccess{
    (isSuccess: boolean):void;
}

/** 是否成功回调函数, 第2个参数开始任意回调参数*/
declare interface QFnIsSuccessAnyArgs{
    (isSuccess: boolean, ...args: any[]):void;
}

/** 错误则无result,有result则无错误 */
declare interface QFnErrorOrResult{
    (err: Error | any | void, result?: any, ...args: any[]): void;
}

/** 错误描述回调 */
declare interface QFnErrorDesc{
    (errDesc: string): void;
}

开源不易,如果对您有帮助,请您动一动您的小手,给作者点 Star,也请您多多关注分享者「邱少羽梦

1.1.6

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.1

5 months ago

1.1.0

5 months ago

1.0.2

5 months ago

1.0.1

6 months ago