-
Notifications
You must be signed in to change notification settings - Fork 25
/
global.d.ts
executable file
·198 lines (165 loc) · 7.48 KB
/
global.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
declare module "*.css" {
const content: {
[propName: string]: any
};
export default content;
}
declare module "*.scss" {
const content: any;
export default content;
}
declare module "*.less" {
const content: any;
export default content;
}
declare module "*.json" {
const content: object;
export default content;
}
interface System {
import<T = any>(module: string): Promise<T>
}
declare const System: System
declare module 'react-async-component';
interface Window {
__state__: any;
}
interface CommonElement {
styleName?: string;
[propName: string]: any;
}
declare namespace JSX {
interface IntrinsicElements {
// 给div元素增加styleName属性,为了兼容 react-css-modules 库
div: CommonElement;
[elemName: string]: any;
}
}
declare namespace Mocha {
export interface IContextDefinition { }
export interface ITestDefinition { }
export interface ISuiteCallbackContext { }
export interface ITestCallbackContext { }
export interface ITest {
<T>(target: Object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>): TypedPropertyDescriptor<T> | void;
}
export interface ISuite {
<TFunction extends Function>(target: TFunction): TFunction | void;
}
}
declare namespace MochaTypeScript {
export interface Suite {
prototype: {
before?: (done?: MochaDone) => void;
after?: (done?: MochaDone) => void;
};
before?: (done?: MochaDone) => void;
after?: (done?: MochaDone) => void;
new(): any;
}
export interface SuiteTrait {
(this: Mocha.ISuiteCallbackContext, ctx: Mocha.ISuiteCallbackContext, ctor: Function): void;
}
export interface TestTrait {
(this: Mocha.ITestCallbackContext, ctx: Mocha.ITestCallbackContext, instance: Object, method: Function): void;
}
export interface IContextDefinition {
/**
* This is either a single trait overload `(trait: MochaTypeScript.SuiteTrait): ClassDecorator`
* or a class decorator overload `(target: Function): void`.
* Can't figure out proper typing.
*/
(args: any): any;
(): ClassDecorator;
(name: string): ClassDecorator;
(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
(trait: MochaTypeScript.SuiteTrait, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(arg: any): any;
only(): ClassDecorator;
only(name: string): ClassDecorator;
only(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(arg: any): any;
skip(): ClassDecorator;
skip(name: string): ClassDecorator;
skip(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
}
export interface ITestDefinition {
(target: Object, propertyKey: string | symbol): void;
(name: string): PropertyDecorator;
(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(target: Object, propertyKey: string | symbol): void;
only(name: string): PropertyDecorator;
only(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(target: Object, propertyKey: string | symbol): void;
skip(name: string): PropertyDecorator;
skip(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
}
}
declare module "mocha-typescript" {
export const suite: Mocha.IContextDefinition & MochaTypeScript.IContextDefinition;
export const test: Mocha.ITestDefinition & MochaTypeScript.ITestDefinition;
export const describe: Mocha.IContextDefinition & MochaTypeScript.IContextDefinition;
export const it: Mocha.ITestDefinition & MochaTypeScript.ITestDefinition;
export function slow(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
export function timeout(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
export function retries(count: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
export function pending<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;
export function only<TFunction extends Function>(target: Object, propertyKey?: string | symbol): void;
export function skip<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;
export function context(target: Object, propertyKey: string | symbol): void;
export const skipOnError: MochaTypeScript.SuiteTrait;
}
declare namespace Mocha {
export interface IContextDefinition {
/**
* This is either a single trait overload `(trait: MochaTypeScript.SuiteTrait): ClassDecorator`
* or a class decorator overload `(target: Function): void`.
* Can't figure out proper typing.
*/
(args: any): any;
(): ClassDecorator;
(name: string): ClassDecorator;
(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
(trait: MochaTypeScript.SuiteTrait, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(arg: any): any;
only(): ClassDecorator;
only(name: string): ClassDecorator;
only(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
only(...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(arg: any): any;
skip(): ClassDecorator;
skip(name: string): ClassDecorator;
skip(name: string, ...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
skip(...traits: MochaTypeScript.SuiteTrait[]): ClassDecorator;
}
export interface ITestDefinition {
(target: Object, propertyKey: string | symbol): void;
(name: string): PropertyDecorator;
(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(target: Object, propertyKey: string | symbol): void;
only(name: string): PropertyDecorator;
only(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
only(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(target: Object, propertyKey: string | symbol): void;
skip(name: string): PropertyDecorator;
skip(name: string, ...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
skip(...traits: MochaTypeScript.TestTrait[]): PropertyDecorator;
}
}
declare var suite: Mocha.IContextDefinition;
declare var test: Mocha.ITestDefinition;
declare var describe: Mocha.IContextDefinition;
declare var it: Mocha.ITestDefinition;
declare var skipOnError: MochaTypeScript.SuiteTrait;
declare function slow(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
declare function timeout(time: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
declare function retries(count: number): PropertyDecorator & ClassDecorator & MochaTypeScript.SuiteTrait & MochaTypeScript.TestTrait;
declare function pending<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;
declare function only<TFunction extends Function>(target: Object, propertyKey?: string | symbol): void;
declare function skip<TFunction extends Function>(target: Object | TFunction, propertyKey?: string | symbol): void;