@qiushaocloud-types/qtypings-browser-global
v1.1.6
Published
this is an npm package of qiushaocloud typings browser global dts file
Downloads
10
Maintainers
Readme
浏览器环境定义一些全局接口、类型等
项目源码
- 自建 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-browser-global:tsconfig.json
中需要配置"files":["node_modules/@qiushaocloud-types/qtypings-browser-global/index.d.ts"]
- 安装 npm 包:
npm install --save-dev @qiushaocloud-types/qtypings-browser-global
TS 定义
browser.d.ts
declare global {
interface Window {
[propName: string]: unknown;
}
interface Document {
[propName: string]: unknown;
}
interface Navigator {
[propName: string]: unknown;
}
}
export {};
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;
}