-
Notifications
You must be signed in to change notification settings - Fork 1
/
PrimitiveTypesTest.ts
204 lines (173 loc) · 7.17 KB
/
PrimitiveTypesTest.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
199
200
201
202
203
204
// tslint:disable:no-namespace
import { AssertFalse, AssertTrue } from "./Assertions";
import {
IsBoolean,
IsDynamicBoolean,
IsNever,
IsNumber,
IsStaticBoolean,
IsString,
IsUndefined,
IsVoid,
} from "./PrimitiveTypes";
enum Fruits {
APPLE = "apple",
ORANGE = "orange",
}
enum HttpCodes {
OK = 200,
NOT_FOUNT = 404,
}
export namespace IsNumberTest {
type Test<T> = IsNumber<T>;
export type _number = AssertTrue<Test<number>>;
export type _boolean = AssertFalse<Test<boolean>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertTrue<Test<HttpCodes>>;
export type _5 = AssertTrue<Test<5>>;
export type _56 = AssertTrue<Test<5 | 6>>;
// TODO
// type _5a = AssertFalse<Test<5 | "a">>;
export type _true = AssertFalse<Test<true>>;
export type _false = AssertFalse<Test<false>>;
export type _a = AssertFalse<Test<"a">>;
export type _apple = AssertFalse<Test<Fruits.APPLE>>;
export type _ok = AssertTrue<Test<HttpCodes.OK>>;
// TODO
// let _booleanOrString: AssertTrue<Test<boolean | string>>;
}
export namespace IsBooleanTest {
type Test<T> = IsBoolean<T>;
export type _number = AssertFalse<Test<number>>;
export type _boolean = AssertTrue<Test<boolean>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export type _true = AssertTrue<Test<true>>;
export type _false = AssertTrue<Test<false>>;
export type _a = AssertFalse<Test<"a">>;
export type _5 = AssertFalse<Test<5>>;
// TODO
// let _booleanOrString: AssertTrue<Test<boolean | string>>;
}
export namespace IsStaticBooleanTest {
type Test<T> = IsStaticBoolean<T>;
// TODO
// type _boolean = AssertFalse<Test<boolean>>;
export type _number = AssertFalse<Test<number>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export type _true = AssertTrue<Test<true>>;
export type _false = AssertTrue<Test<false>>;
export type _a = AssertFalse<Test<"a">>;
export type _5 = AssertFalse<Test<5>>;
}
export namespace IsDynamicBooleanTest {
type Test<T> = IsDynamicBoolean<T>;
// TODO
// type _boolean = AssertTrue<Test<boolean>>;
export type _number = AssertFalse<Test<number>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export type _true = AssertFalse<Test<true>>;
export type _false = AssertFalse<Test<false>>;
export type _a = AssertFalse<Test<"a">>;
export type _5 = AssertFalse<Test<5>>;
// TODO
// type _boolean = AssertFalse<Test<boolean>>;
// let _booleanOrString: AssertTrue<Test<boolean | string>>;
}
export namespace IsStringTest {
type Test<T> = IsString<T>;
export type _number = AssertFalse<Test<number>>;
export type _boolean = AssertFalse<Test<boolean>>;
export type _string = AssertTrue<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertTrue<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export let _true: AssertFalse<Test<true>>;
export let _false: AssertFalse<Test<false>>;
export let _a: AssertTrue<Test<"a">>;
export let _5: AssertFalse<Test<5>>;
// TODO
// let _booleanOrString: AssertTrue<Test<boolean | string>>;
}
export namespace IsNeverTest {
type Test<T> = IsNever<T>;
export type _number = AssertFalse<Test<number>>;
export type _boolean = AssertFalse<Test<boolean>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertTrue<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export let _true: AssertFalse<Test<true>>;
export let _false: AssertFalse<Test<false>>;
export let _a: AssertFalse<Test<"a">>;
export let _5: AssertFalse<Test<5>>;
}
export namespace IsVoidTest {
type Test<T> = IsVoid<T>;
export type _number = AssertFalse<Test<number>>;
export type _boolean = AssertFalse<Test<boolean>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertTrue<Test<void>>;
// TODO ?
// type _undefined = AssertFalse<Test<undefined>>;
export type _never = AssertFalse<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export const _true: Test<true> = false;
export const _false: Test<false> = false;
export const _a: Test<"a"> = false;
export const _5: Test<5> = false;
}
export namespace IsUndefinedTest {
type Test<T> = IsUndefined<T>;
export type _number = AssertFalse<Test<number>>;
export type _boolean = AssertFalse<Test<boolean>>;
export type _string = AssertFalse<Test<string>>;
export type _symbol = AssertFalse<Test<symbol>>;
export type _void = AssertFalse<Test<void>>;
export type _undefined = AssertTrue<Test<undefined>>;
export type _never = AssertTrue<Test<never>>;
export type _function = AssertFalse<Test<Function>>;
export type _fruits = AssertFalse<Test<Fruits>>;
export type _http_codes = AssertFalse<Test<HttpCodes>>;
export let _true: AssertFalse<Test<true>>;
export let _false: AssertFalse<Test<false>>;
export let _a: AssertFalse<Test<"a">>;
export let _5: AssertFalse<Test<5>>;
}