23
23
import { ArrayLike } from '@stdlib/types/array' ;
24
24
import { ndarray , boolndarray , integerndarray , typedndarray } from '@stdlib/types/ndarray' ;
25
25
26
+ /**
27
+ * Input array.
28
+ */
29
+ type InputArray < T > = typedndarray < T > ;
30
+
26
31
/**
27
32
* Returns a boolean indicating whether an element passes a test.
28
33
*
@@ -55,7 +60,7 @@ type Binary<T, ThisArg> = ( this: ThisArg, value: T, indices: Array<number> ) =>
55
60
* @param arr - input array
56
61
* @returns boolean indicating whether an ndarray element passes a test
57
62
*/
58
- type Ternary < T , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > , arr : typedndarray < T > ) => boolean ;
63
+ type Ternary < T , U , ThisArg > = ( this : ThisArg , value : T , indices : Array < number > , arr : U ) => boolean ;
59
64
60
65
/**
61
66
* Returns a boolean indicating whether an element passes a test.
@@ -65,7 +70,7 @@ type Ternary<T, ThisArg> = ( this: ThisArg, value: T, indices: Array<number>, ar
65
70
* @param arr - input array
66
71
* @returns boolean indicating whether an ndarray element passes a test
67
72
*/
68
- type Predicate < T , ThisArg > = Nullary < ThisArg > | Unary < T , ThisArg > | Binary < T , ThisArg > | Ternary < T , ThisArg > ;
73
+ type Predicate < T , U , ThisArg > = Nullary < ThisArg > | Unary < T , ThisArg > | Binary < T , ThisArg > | Ternary < T , U , ThisArg > ;
69
74
70
75
/**
71
76
* Base options.
@@ -127,7 +132,7 @@ interface SomeBy {
127
132
* var v = out.get();
128
133
* // returns true
129
134
*/
130
- < T = unknown , U = unknown > ( x : ndarray , n : integerndarray | number , predicate : Predicate < T , U > , thisArg ?: ThisParameterType < Predicate < T , U > > ) : boolndarray ;
135
+ < T = unknown , U extends InputArray < T > = InputArray < T > , ThisArg = unknown > ( x : U , n : integerndarray | number , predicate : Predicate < T , U , ThisArg > , thisArg ?: ThisParameterType < Predicate < T , U , ThisArg > > ) : boolndarray ;
131
136
132
137
/**
133
138
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -168,7 +173,7 @@ interface SomeBy {
168
173
* var v = out.get();
169
174
* // returns true
170
175
*/
171
- < T = unknown , U = unknown > ( x : ndarray , n : integerndarray | number , options : Options , predicate : Predicate < T , U > , thisArg ?: ThisParameterType < Predicate < T , U > > ) : boolndarray ;
176
+ < T = unknown , U extends InputArray < T > = InputArray < T > , ThisArg = unknown > ( x : U , n : integerndarray | number , options : Options , predicate : Predicate < T , U , ThisArg > , thisArg ?: ThisParameterType < Predicate < T , U , ThisArg > > ) : boolndarray ;
172
177
173
178
/**
174
179
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -213,7 +218,7 @@ interface SomeBy {
213
218
* var v = out.get();
214
219
* // returns true
215
220
*/
216
- assign < T = unknown , U extends ndarray = ndarray , V = unknown > ( x : ndarray , n : integerndarray | number , y : U , predicate : Predicate < T , V > , thisArg ?: ThisParameterType < Predicate < T , V > > ) : U ;
221
+ assign < T = unknown , U extends InputArray < T > = InputArray < T > , V extends ndarray = ndarray , ThisArg = unknown > ( x : ndarray , n : integerndarray | number , y : V , predicate : Predicate < T , U , ThisArg > , thisArg ?: ThisParameterType < Predicate < T , U , ThisArg > > ) : V ;
217
222
218
223
/**
219
224
* Tests whether at least `n` elements along one or more ndarray dimensions pass a test implemented by a predicate function.
@@ -260,7 +265,7 @@ interface SomeBy {
260
265
* var v = out.get();
261
266
* // returns true
262
267
*/
263
- assign < T = unknown , U extends ndarray = ndarray , V = unknown > ( x : ndarray , n : integerndarray | number , y : U , options : BaseOptions , predicate : Predicate < T , V > , thisArg ?: ThisParameterType < Predicate < T , V > > ) : U ;
268
+ assign < T = unknown , U extends InputArray < T > = InputArray < T > , V extends ndarray = ndarray , ThisArg = unknown > ( x : ndarray , n : integerndarray | number , y : V , options : BaseOptions , predicate : Predicate < T , U , ThisArg > , thisArg ?: ThisParameterType < Predicate < T , U , ThisArg > > ) : V ;
264
269
}
265
270
266
271
/**
0 commit comments