Skip to content

Commit 21cddc4

Browse files
committed
fix: add missing this parameter
1 parent b45ab4c commit 21cddc4

File tree

1 file changed

+9
-9
lines changed
  • lib/node_modules/@stdlib/utils/count-by/docs/types

1 file changed

+9
-9
lines changed

lib/node_modules/@stdlib/utils/count-by/docs/types/index.d.ts

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* limitations under the License.
1717
*/
1818

19-
// TypeScript Version: 2.0
19+
// TypeScript Version: 4.1
2020

2121
/// <reference types="@stdlib/types"/>
2222

@@ -25,27 +25,27 @@ import { Collection } from '@stdlib/types/array';
2525
/**
2626
* Interface defining function options.
2727
*/
28-
interface Options<T> {
28+
interface Options<T, U> {
2929
/**
3030
* Execution context.
3131
*/
32-
thisArg?: ThisParameterType<Indicator<T>>;
32+
thisArg?: ThisParameterType<Indicator<T, U>>;
3333
}
3434

3535
/**
3636
* Specifies which group an element in the input collection belongs to.
3737
*
3838
* @returns object key
3939
*/
40-
type Nullary = () => string | symbol | number;
40+
type Nullary<U> = ( this: U ) => string | symbol | number;
4141

4242
/**
4343
* Specifies which group an element in the input collection belongs to.
4444
*
4545
* @param value - collection value
4646
* @returns object key
4747
*/
48-
type Unary<T> = ( value: T ) => string | symbol | number;
48+
type Unary<T, U> = ( this: U, value: T ) => string | symbol | number;
4949

5050
/**
5151
* Specifies which group an element in the input collection belongs to.
@@ -54,7 +54,7 @@ type Unary<T> = ( value: T ) => string | symbol | number;
5454
* @param index - collection index
5555
* @returns object key
5656
*/
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;
5858

5959
/**
6060
* 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;
6363
* @param index - collection index
6464
* @returns object key
6565
*/
66-
type Indicator<T> = Nullary | Unary<T> | Binary<T>;
66+
type Indicator<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U>;
6767

6868
/**
6969
* Interface describing returned results.
@@ -102,7 +102,7 @@ interface Results<T> {
102102
* var out = countBy( arr, indicator );
103103
* // returns { 'b': 3, 'f': 1 }
104104
*/
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
106106

107107
/**
108108
* 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
133133
* var out = countBy( arr, indicator );
134134
* // returns { 'b': 3, 'f': 1 }
135135
*/
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>;
137137

138138

139139
// EXPORTS //

0 commit comments

Comments
 (0)