Installation
npm install --save @types/foreach
Summary
This package contains type definitions for foreach (https://github.com/manuelstofer/foreach).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/foreach.
index.d.ts
/**
* Performs the specified action for each element in an array.
*
* @param callbackfn A function that accepts up to three arguments.
* `forEach` calls the `callbackfn` function one time for each element in the array.
* @param thisArg A value to which the `this` keyword can refer in the `callbackfn` function.
* If `thisArg` is omitted, `undefined` is used as the `this` value.
*/
declare function forEach<O extends ArrayLike<unknown>, THIS_ARG = undefined>(
array: O,
callbackfn: (
this: THIS_ARG,
value: O extends ArrayLike<infer T> ? T : unknown,
index: number,
array: O,
) => void,
thisArg?: THIS_ARG,
): void;
/**
* Performs the specified action for each own property in an object.
*
* @param callbackfn A function that accepts up to three arguments.
* `forEach` calls the `callbackfn` function one time for each own property in the object.
* @param thisArg A value to which the `this` keyword can refer in the `callbackfn` function.
* If `thisArg` is omitted, `undefined` is used as the `this` value.
*/
declare function forEach<O extends Record<string, unknown>, THIS_ARG = undefined>(
target: O,
callbackfn: (
this: THIS_ARG,
value: O extends Record<string, infer T> ? T : unknown,
property: string,
target: O,
) => void,
thisArg?: THIS_ARG,
): void;
export = forEach;
Additional Details
- Last updated: Tue, 07 Nov 2023 03:09:37 GMT
- Dependencies: none
Credits
These definitions were written by ExE Boss, and Jordan Harband.