16
16
* limitations under the License.
17
17
*/
18
18
19
- // TypeScript Version: 2.0
19
+ // TypeScript Version: 4.1
20
20
21
21
/// <reference types="@stdlib/types"/>
22
22
@@ -25,27 +25,27 @@ import { Collection } from '@stdlib/types/array';
25
25
/**
26
26
* Interface defining function options.
27
27
*/
28
- interface Options < T > {
28
+ interface Options < T , U > {
29
29
/**
30
30
* Execution context.
31
31
*/
32
- thisArg ?: ThisParameterType < Indicator < T > > ;
32
+ thisArg ?: ThisParameterType < Indicator < T , U > > ;
33
33
}
34
34
35
35
/**
36
36
* Specifies which group an element in the input collection belongs to.
37
37
*
38
38
* @returns object key
39
39
*/
40
- type Nullary = ( ) => string | symbol | number ;
40
+ type Nullary < U > = ( this : U ) => string | symbol | number ;
41
41
42
42
/**
43
43
* Specifies which group an element in the input collection belongs to.
44
44
*
45
45
* @param value - collection value
46
46
* @returns object key
47
47
*/
48
- type Unary < T > = ( value : T ) => string | symbol | number ;
48
+ type Unary < T , U > = ( this : U , value : T ) => string | symbol | number ;
49
49
50
50
/**
51
51
* Specifies which group an element in the input collection belongs to.
@@ -54,7 +54,7 @@ type Unary<T> = ( value: T ) => string | symbol | number;
54
54
* @param index - collection index
55
55
* @returns object key
56
56
*/
57
- type Binary < T > = ( value : T , index : number ) => string | symbol | number ;
57
+ type Binary < T , U > = ( this : U , value : T , index : number ) => string | symbol | number ;
58
58
59
59
/**
60
60
* Specifies which group an element in the input collection belongs to.
@@ -63,7 +63,7 @@ type Binary<T> = ( value: T, index: number ) => string | symbol | number;
63
63
* @param index - collection index
64
64
* @returns object key
65
65
*/
66
- type Indicator < T > = Nullary | Unary < T > | Binary < T > ;
66
+ type Indicator < T , U > = Nullary < U > | Unary < T , U > | Binary < T , U > ;
67
67
68
68
/**
69
69
* Interface describing returned results.
@@ -102,7 +102,7 @@ interface Results<T> {
102
102
* var out = countBy( arr, indicator );
103
103
* // returns { 'b': 3, 'f': 1 }
104
104
*/
105
- declare function countBy < T = unknown > ( collection : Collection < T > , indicator : Indicator < T > ) : Results < T > ;
105
+ declare function countBy < T = unknown , U = unknown > ( collection : Collection < T > , indicator : Indicator < T , U > ) : Results < T > ; // tslint:disable-line:no-unnecessary-generics
106
106
107
107
/**
108
108
* Groups values according to an indicator function and returns group counts.
@@ -133,7 +133,7 @@ declare function countBy<T = unknown>( collection: Collection<T>, indicator: Ind
133
133
* var out = countBy( arr, indicator );
134
134
* // returns { 'b': 3, 'f': 1 }
135
135
*/
136
- declare function countBy < T = unknown > ( collection : Collection < T > , options : Options < T > , indicator : Indicator < T > ) : Results < T > ;
136
+ declare function countBy < T = unknown , U = unknown > ( collection : Collection < T > , options : Options < T , U > , indicator : Indicator < T , U > ) : Results < T > ;
137
137
138
138
139
139
// EXPORTS //
0 commit comments