-
Notifications
You must be signed in to change notification settings - Fork 6
/
register.ts
54 lines (46 loc) · 1.28 KB
/
register.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
// tslint:disable callable-types
// tslint:disable variable-name
declare type NoopDecorator = (
_target: object,
_propertyKey: string,
_descriptor?: PropertyDescriptor
) => void;
declare var global: NodeJS.Global;
declare global {
/**
* Indicates that this function or variable is being overridden
* from the implemented or extended parent class.
*
* @see [TSLint Override](https://github.com/hmil/tslint-override)
*/
var override: NoopDecorator;
/**
* Indicates that this function or variable is being overridden
* from the implemented or extended parent class.
*
* @see [TSLint Override](https://github.com/hmil/tslint-override)
*/
var Override: NoopDecorator;
interface Window {
override: NoopDecorator;
Override: NoopDecorator;
}
interface WorkerGlobalScope {
override: NoopDecorator;
Override: NoopDecorator;
}
namespace NodeJS {
interface Global {
override: NoopDecorator;
Override: NoopDecorator;
}
}
}
export const ctx =
typeof global === 'undefined' ? (typeof self === 'undefined' ? undefined : self) : global;
export const override: NoopDecorator = () => { /* noop */ };
export const Override: NoopDecorator = () => { /* noop */ };
if (ctx) {
ctx.override = override;
ctx.Override = Override;
}