Skip to content

Commit 71f0dcb

Browse files
committed
fix: add missing this parameter
1 parent 0216d80 commit 71f0dcb

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

lib/node_modules/@stdlib/utils/for-each-right/docs/types/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ import { Collection } from '@stdlib/types/array';
2525
/**
2626
* Function invoked for each collection element.
2727
*/
28-
type Nullary = () => void;
28+
type Nullary<U> = ( this: U ) => void;
2929

3030
/**
3131
* Function invoked for each collection element.
3232
*
3333
* @param value - collection value
3434
*/
35-
type Unary<T> = ( value: T ) => void;
35+
type Unary<T, U> = ( this: U, value: T ) => void;
3636

3737
/**
3838
* Function invoked for each collection element.
3939
*
4040
* @param value - collection value
4141
* @param index - collection index
4242
*/
43-
type Binary<T> = ( value: T, index: number ) => void;
43+
type Binary<T, U> = ( this: U, value: T, index: number ) => void;
4444

4545
/**
4646
* Function invoked for each collection element.
@@ -49,7 +49,7 @@ type Binary<T> = ( value: T, index: number ) => void;
4949
* @param index - collection index
5050
* @param collection - input collection
5151
*/
52-
type Ternary<T> = ( value: T, index: number, collection: Collection<T> ) => void;
52+
type Ternary<T, U> = ( this: U, value: T, index: number, collection: Collection<T> ) => void;
5353

5454
/**
5555
* Function invoked for each collection element.
@@ -58,7 +58,7 @@ type Ternary<T> = ( value: T, index: number, collection: Collection<T> ) => void
5858
* @param index - collection index
5959
* @param collection - input collection
6060
*/
61-
type Callback<T> = Nullary | Unary<T> | Binary<T> | Ternary<T>;
61+
type Callback<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>;
6262

6363
/**
6464
* Invokes a function once for each element in a collection, iterating from right to left.
@@ -87,7 +87,7 @@ type Callback<T> = Nullary | Unary<T> | Binary<T> | Ternary<T>;
8787
*
8888
* forEachRight( arr, log );
8989
*/
90-
declare function forEachRight<T = unknown>( collection: Collection<T>, fcn: Callback<T>, thisArg?: ThisParameterType<Callback<T>> ): Collection<T>;
90+
declare function forEachRight<T = unknown, U = unknown>( collection: Collection<T>, fcn: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): Collection<T>;
9191

9292

9393
// EXPORTS //

lib/node_modules/@stdlib/utils/for-each/docs/types/index.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ import { Collection } from '@stdlib/types/array';
2525
/**
2626
* Function invoked for each collection element.
2727
*/
28-
type Nullary = () => void;
28+
type Nullary<U> = ( this: U ) => void;
2929

3030
/**
3131
* Function invoked for each collection element.
3232
*
3333
* @param value - collection value
3434
*/
35-
type Unary<T> = ( value: T ) => void;
35+
type Unary<T, U> = ( this: U, value: T ) => void;
3636

3737
/**
3838
* Function invoked for each collection element.
3939
*
4040
* @param value - collection value
4141
* @param index - collection index
4242
*/
43-
type Binary<T> = ( value: T, index: number ) => void;
43+
type Binary<T, U> = ( this: U, value: T, index: number ) => void;
4444

4545
/**
4646
* Function invoked for each collection element.
@@ -49,7 +49,7 @@ type Binary<T> = ( value: T, index: number ) => void;
4949
* @param index - collection index
5050
* @param collection - input collection
5151
*/
52-
type Ternary<T> = ( value: T, index: number, collection: Collection<T> ) => void;
52+
type Ternary<T, U> = ( this: U, value: T, index: number, collection: Collection<T> ) => void;
5353

5454
/**
5555
* Function invoked for each collection element.
@@ -58,7 +58,7 @@ type Ternary<T> = ( value: T, index: number, collection: Collection<T> ) => void
5858
* @param index - collection index
5959
* @param collection - input collection
6060
*/
61-
type Callback<T> = Nullary | Unary<T> | Binary<T> | Ternary<T>;
61+
type Callback<T, U> = Nullary<U> | Unary<T, U> | Binary<T, U> | Ternary<T, U>;
6262

6363
/**
6464
* Invokes a function once for each element in a collection.
@@ -85,7 +85,7 @@ type Callback<T> = Nullary | Unary<T> | Binary<T> | Ternary<T>;
8585
*
8686
* forEach( arr, log );
8787
*/
88-
declare function forEach<T = unknown>( collection: Collection<T>, fcn: Callback<T>, thisArg?: ThisParameterType<Callback<T>> ): Collection<T>;
88+
declare function forEach<T = unknown, U = unknown>( collection: Collection<T>, fcn: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ): Collection<T>;
8989

9090

9191
// EXPORTS //

0 commit comments

Comments
 (0)