-
Notifications
You must be signed in to change notification settings - Fork 2
/
globals.d.ts
109 lines (99 loc) · 2.5 KB
/
globals.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
declare global {
type $Shape<T> = T
type $Exact<T> = T
type $Spread<A, B> = A & B
type $ReadOnlyArray<T> = Array<T>
type $NonMaybeType<T> = T
type $Subtype<T> = T
type $Supertype<T> = T
type empty = never
type mixed = any
type $Diff<A, B> = A & B
type $ElementType<T extends Object, K extends keyof T> = T[K]
type $PropertyType<T extends Object, K extends keyof T> = T[K]
type $Keys<T extends Object> = keyof T
type Class<T, K = { new (...args: any[]): T }> = K
type $Pred<N extends Number> = (value: any) => boolean
type $ReadOnly<T> = T
type $Refine<T, P, N extends Number> = T
type $Values<T, K extends keyof T = keyof T> = T[K]
type $ObjMap<T extends Object, F extends Function> = {
[K in keyof T]: T[K]
}
type IteratorResult<Yield, Return = void> =
| {
done: true
value: Return
}
| {
done: false
value: Yield
}
interface Generator<Yield, Return = void, Next = void> {
'@@iterator'(): $Iterator<Yield, Return, Next>
next(value: void): IteratorResult<Yield>
return<R>(value: R): IteratorResult<Yield, R | Return>
throw(error?: any): IteratorResult<Yield>
}
interface $AsyncIterator<Yield, Return = void, Next = void> {
'@@asyncIterator'(): $AsyncIterator<Yield, Return, Next>
next(value?: Next): Promise<IteratorResult<Yield, Return>>
}
interface AsyncGenerator<Yield, Return = void, Next = void> {
'@@asyncIterator'(): $AsyncIterator<Yield, Return, Next>
next(value?: Next): Promise<IteratorResult<Yield, Return>>
return<R>(value: R): Promise<IteratorResult<Yield, R | Return>>
throw(error?: any): Promise<IteratorResult<Yield, Return>>
}
interface $Iterator<Yield, Return = void, Next = void> {
'@@iterator'(): $Iterator<Yield, Return, Next>
next(value?: Next): IteratorResult<Yield, Return>
}
type $Compose = (
<A, B, R>(
a: A,
b: B,
noc: void,
nod: void,
noe: void,
nof: void
) => R
) & (
<A, B, C, R>(
a: A,
b: B,
c: C,
nod: void,
noe: void,
nof: void
) => R
) & (
<A, B, C, D, R>(
a: A,
b: B,
c: C,
d: D,
noe: void,
nof: void
) => R
) & (
<A, B, C, D, E, R>(
a: A,
b: B,
c: C,
d: D,
e: E,
nof: void
) => R
) & (
<A, B, C, D, E, F, R>(
a: A,
b: B,
c: C,
d: D,
e: E,
f: F
) => R
)
}
// https://gist.github.com/zerobias/7099397c6b1cc15ba650d186da064a7a