-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
/
exports.ts
112 lines (85 loc) · 2.82 KB
/
exports.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
// Some tests look like they are repeated in order to avoid false positives.
import { expect, test } from 'tstyche';
import * as Immutable from 'immutable';
import {
List,
Map,
OrderedMap,
OrderedSet,
Range,
Repeat,
Seq,
Set,
Stack,
Collection,
} from 'immutable';
test('named imports', () => {
expect(List).type.toEqual<typeof List>();
expect(Map).type.toEqual<typeof Map>();
expect(OrderedMap).type.toEqual<typeof OrderedMap>();
expect(OrderedSet).type.toEqual<typeof OrderedSet>();
expect(Range).type.toEqual<
(
start: number,
end: number,
step?: number | undefined
) => Seq.Indexed<number>
>();
expect(Repeat).type.toEqual<
<T>(value: T, times?: number | undefined) => Seq.Indexed<T>
>();
expect(Seq).type.toEqual<typeof Seq>();
expect(Set).type.toEqual<typeof Set>();
expect(Stack).type.toEqual<typeof Stack>();
expect(Collection).type.toEqual<typeof Collection>();
expect(Collection.Set).type.toEqual<
<T>(
collection?: Iterable<T> | ArrayLike<T> | undefined
) => Collection.Set<T>
>();
expect(Collection.Keyed).type.toEqual<{
<K, V>(collection?: Iterable<[K, V]> | undefined): Collection.Keyed<K, V>;
<V>(obj: { [key: string]: V }): Collection.Keyed<string, V>;
}>();
expect(Collection.Indexed).type.toEqual<
<T>(
collection?: Iterable<T> | ArrayLike<T> | undefined
) => Collection.Indexed<T>
>();
});
test('namespace import', () => {
expect(Immutable.List).type.toEqual<typeof Immutable.List>();
expect(Immutable.Map).type.toEqual<typeof Immutable.Map>();
expect(Immutable.OrderedMap).type.toEqual<typeof Immutable.OrderedMap>();
expect(Immutable.OrderedSet).type.toEqual<typeof Immutable.OrderedSet>();
expect(Immutable.Range).type.toEqual<
(
start: number,
end: number,
step?: number | undefined
) => Immutable.Seq.Indexed<number>
>();
expect(Immutable.Repeat).type.toEqual<
<T>(value: T, times?: number | undefined) => Immutable.Seq.Indexed<T>
>();
expect(Immutable.Seq).type.toEqual<typeof Immutable.Seq>();
expect(Immutable.Set).type.toEqual<typeof Immutable.Set>();
expect(Immutable.Stack).type.toEqual<typeof Immutable.Stack>();
expect(Immutable.Collection).type.toEqual<typeof Immutable.Collection>();
expect(Immutable.Collection.Set).type.toEqual<
<T>(
collection?: Iterable<T> | ArrayLike<T> | undefined
) => Immutable.Collection.Set<T>
>();
expect(Immutable.Collection.Keyed).type.toEqual<{
<K, V>(
collection?: Iterable<[K, V]> | undefined
): Immutable.Collection.Keyed<K, V>;
<V>(obj: { [key: string]: V }): Immutable.Collection.Keyed<string, V>;
}>();
expect(Immutable.Collection.Indexed).type.toEqual<
<T>(
collection?: Iterable<T> | ArrayLike<T> | undefined
) => Immutable.Collection.Indexed<T>
>();
});