-
Notifications
You must be signed in to change notification settings - Fork 0
/
spec.ts
45 lines (37 loc) · 1.47 KB
/
spec.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
import assert from 'static-type-assert'
import compare = assert.compare
import {
Any,
NotAny,
Equal,
NotEqual,
Extends,
Compare
} from './index'
compare<Any<any>, true>('equal')
compare<Any<string>, false>('equal')
compare<Any<number>, false>('equal')
compare<NotAny<any>, false>('equal')
compare<NotAny<string>, true>('equal')
compare<NotAny<number>, true>('equal')
compare<Equal<123, 123>, true>('equal')
compare<Equal<string, string>, true>('equal')
compare<Equal<123, '123'>, false>('equal')
compare<Equal<number, string>, false>('equal')
compare<NotEqual<123, 123>, false>('equal')
compare<NotEqual<string, string>, false>('equal')
compare<NotEqual<123, '123'>, true>('equal')
compare<NotEqual<number, string>, true>('equal')
compare<Extends<123, 123 | 456>, true>('equal')
compare<Extends<123, number>, true>('equal')
compare<Extends<'abc', number>, false>('equal')
compare<Compare<123, 123>, 'equal' | 'broaderRight' | 'broaderLeft'>('equal')
compare<Compare<123 | 456, 123>, 'broaderLeft'>('equal')
compare<Compare<123, 456 | 123>, 'broaderRight'>('equal')
compare<Compare<123 | 456, 456 | 789>, 'mismatch'>('equal')
compare<Compare<string, number>, 'mismatch'>('equal')
compare<Compare.Strict<123, 123>, 'equal'>('equal')
compare<Compare.Strict<123 | 456, 123>, 'broaderLeft'>('equal')
compare<Compare.Strict<123, 456 | 123>, 'broaderRight'>('equal')
compare<Compare.Strict<123 | 456, 456 | 789>, 'mismatch'>('equal')
compare<Compare.Strict<string, number>, 'mismatch'>('equal')