@@ -43,24 +43,45 @@ export function createSelector<State, S1, Result>(
43
43
s1 : Selector < State , S1 > ,
44
44
projector : ( S1 : S1 ) => Result
45
45
) : MemoizedSelector < State , Result > ;
46
+ export function createSelector < State , S1 , Result > (
47
+ selectors : [ Selector < State , S1 > ] ,
48
+ projector : ( s1 : S1 ) => Result
49
+ ) : MemoizedSelector < State , Result > ;
46
50
export function createSelector < State , S1 , S2 , Result > (
47
51
s1 : Selector < State , S1 > ,
48
52
s2 : Selector < State , S2 > ,
49
53
projector : ( s1 : S1 , s2 : S2 ) => Result
50
54
) : MemoizedSelector < State , Result > ;
55
+ export function createSelector < State , S1 , S2 , Result > (
56
+ selectors : [ Selector < State , S1 > , Selector < State , S2 > ] ,
57
+ projector : ( s1 : S1 , s2 : S2 ) => Result
58
+ ) : MemoizedSelector < State , Result > ;
51
59
export function createSelector < State , S1 , S2 , S3 , Result > (
52
60
s1 : Selector < State , S1 > ,
53
61
s2 : Selector < State , S2 > ,
54
62
s3 : Selector < State , S3 > ,
55
63
projector : ( s1 : S1 , s2 : S2 , s3 : S3 ) => Result
56
64
) : MemoizedSelector < State , Result > ;
65
+ export function createSelector < State , S1 , S2 , S3 , Result > (
66
+ selectors : [ Selector < State , S1 > , Selector < State , S2 > , Selector < State , S3 > ] ,
67
+ projector : ( s1 : S1 , s2 : S2 , s3 : S3 ) => Result
68
+ ) : MemoizedSelector < State , Result > ;
57
69
export function createSelector < State , S1 , S2 , S3 , S4 , Result > (
58
70
s1 : Selector < State , S1 > ,
59
71
s2 : Selector < State , S2 > ,
60
72
s3 : Selector < State , S3 > ,
61
73
s4 : Selector < State , S4 > ,
62
74
projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 ) => Result
63
75
) : MemoizedSelector < State , Result > ;
76
+ export function createSelector < State , S1 , S2 , S3 , S4 , Result > (
77
+ selectors : [
78
+ Selector < State , S1 > ,
79
+ Selector < State , S2 > ,
80
+ Selector < State , S3 > ,
81
+ Selector < State , S4 >
82
+ ] ,
83
+ projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 ) => Result
84
+ ) : MemoizedSelector < State , Result > ;
64
85
export function createSelector < State , S1 , S2 , S3 , S4 , S5 , Result > (
65
86
s1 : Selector < State , S1 > ,
66
87
s2 : Selector < State , S2 > ,
@@ -69,6 +90,16 @@ export function createSelector<State, S1, S2, S3, S4, S5, Result>(
69
90
s5 : Selector < State , S5 > ,
70
91
projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 ) => Result
71
92
) : MemoizedSelector < State , Result > ;
93
+ export function createSelector < State , S1 , S2 , S3 , S4 , S5 , Result > (
94
+ selectors : [
95
+ Selector < State , S1 > ,
96
+ Selector < State , S2 > ,
97
+ Selector < State , S3 > ,
98
+ Selector < State , S4 > ,
99
+ Selector < State , S5 >
100
+ ] ,
101
+ projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 ) => Result
102
+ ) : MemoizedSelector < State , Result > ;
72
103
export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , Result > (
73
104
s1 : Selector < State , S1 > ,
74
105
s2 : Selector < State , S2 > ,
@@ -78,6 +109,17 @@ export function createSelector<State, S1, S2, S3, S4, S5, S6, Result>(
78
109
s6 : Selector < State , S6 > ,
79
110
projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 , s6 : S6 ) => Result
80
111
) : MemoizedSelector < State , Result > ;
112
+ export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , Result > (
113
+ selectors : [
114
+ Selector < State , S1 > ,
115
+ Selector < State , S2 > ,
116
+ Selector < State , S3 > ,
117
+ Selector < State , S4 > ,
118
+ Selector < State , S5 > ,
119
+ Selector < State , S6 >
120
+ ] ,
121
+ projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 , s6 : S6 ) => Result
122
+ ) : MemoizedSelector < State , Result > ;
81
123
export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , S7 , Result > (
82
124
s1 : Selector < State , S1 > ,
83
125
s2 : Selector < State , S2 > ,
@@ -88,6 +130,18 @@ export function createSelector<State, S1, S2, S3, S4, S5, S6, S7, Result>(
88
130
s7 : Selector < State , S7 > ,
89
131
projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 , s6 : S6 , s7 : S7 ) => Result
90
132
) : MemoizedSelector < State , Result > ;
133
+ export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , S7 , Result > (
134
+ selectors : [
135
+ Selector < State , S1 > ,
136
+ Selector < State , S2 > ,
137
+ Selector < State , S3 > ,
138
+ Selector < State , S4 > ,
139
+ Selector < State , S5 > ,
140
+ Selector < State , S6 > ,
141
+ Selector < State , S7 >
142
+ ] ,
143
+ projector : ( s1 : S1 , s2 : S2 , s3 : S3 , s4 : S4 , s5 : S5 , s6 : S6 , s7 : S7 ) => Result
144
+ ) : MemoizedSelector < State , Result > ;
91
145
export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , S7 , S8 , Result > (
92
146
s1 : Selector < State , S1 > ,
93
147
s2 : Selector < State , S2 > ,
@@ -108,7 +162,35 @@ export function createSelector<State, S1, S2, S3, S4, S5, S6, S7, S8, Result>(
108
162
s8 : S8
109
163
) => Result
110
164
) : MemoizedSelector < State , Result > ;
111
- export function createSelector ( ...args : any [ ] ) : Selector < any , any > {
165
+ export function createSelector < State , S1 , S2 , S3 , S4 , S5 , S6 , S7 , S8 , Result > (
166
+ selectors : [
167
+ Selector < State , S1 > ,
168
+ Selector < State , S2 > ,
169
+ Selector < State , S3 > ,
170
+ Selector < State , S4 > ,
171
+ Selector < State , S5 > ,
172
+ Selector < State , S6 > ,
173
+ Selector < State , S7 > ,
174
+ Selector < State , S8 >
175
+ ] ,
176
+ projector : (
177
+ s1 : S1 ,
178
+ s2 : S2 ,
179
+ s3 : S3 ,
180
+ s4 : S4 ,
181
+ s5 : S5 ,
182
+ s6 : S6 ,
183
+ s7 : S7 ,
184
+ s8 : S8
185
+ ) => Result
186
+ ) : MemoizedSelector < State , Result > ;
187
+ export function createSelector ( ...input : any [ ] ) : Selector < any , any > {
188
+ let args = input ;
189
+ if ( Array . isArray ( args [ 0 ] ) ) {
190
+ const [ head , ...tail ] = args ;
191
+ args = [ ...head , ...tail ] ;
192
+ }
193
+
112
194
const selectors = args . slice ( 0 , args . length - 1 ) ;
113
195
const projector = args [ args . length - 1 ] ;
114
196
const memoizedSelectors = selectors . filter (
0 commit comments