@qiushaocloud-types/qtypings-nodejs-global
v1.1.6
Published
this is an npm package of qiushaocloud typings nodejs global dts file
Downloads
19
Maintainers
Readme
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
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;
}