mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 19:07:08 +00:00
angular.forEach obj parameter in callback function (#14953)
This commit is contained in:
parent
c12c733253
commit
2efe76ecf0
@ -587,7 +587,8 @@ namespace TestPromise {
|
||||
function test_angular_forEach() {
|
||||
const values: { [key: string]: string } = { name: 'misko', gender: 'male' };
|
||||
const log: string[] = [];
|
||||
angular.forEach(values, (value, key) => {
|
||||
angular.forEach(values, (value, key, obj) => {
|
||||
obj[key] = value;
|
||||
this.push(key + ': ' + value);
|
||||
}, log);
|
||||
// expect(log).toEqual(['name: misko', 'gender: male']);
|
||||
|
||||
6
angular/index.d.ts
vendored
6
angular/index.d.ts
vendored
@ -97,7 +97,7 @@ declare namespace angular {
|
||||
* @param iterator Iterator function.
|
||||
* @param context Object to become context (this) for the iterator function.
|
||||
*/
|
||||
forEach<T>(obj: T[], iterator: (value: T, key: number) => any, context?: any): any;
|
||||
forEach<T>(obj: T[], iterator: (value: T, key: number, obj: T[]) => void, context?: any): T[];
|
||||
/**
|
||||
* Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional.
|
||||
*
|
||||
@ -107,7 +107,7 @@ declare namespace angular {
|
||||
* @param iterator Iterator function.
|
||||
* @param context Object to become context (this) for the iterator function.
|
||||
*/
|
||||
forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string) => any, context?: any): any;
|
||||
forEach<T>(obj: { [index: string]: T; }, iterator: (value: T, key: string, obj: { [index: string]: T; }) => void, context?: any): { [index: string]: T; };
|
||||
/**
|
||||
* Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional.
|
||||
*
|
||||
@ -117,7 +117,7 @@ declare namespace angular {
|
||||
* @param iterator Iterator function.
|
||||
* @param context Object to become context (this) for the iterator function.
|
||||
*/
|
||||
forEach(obj: any, iterator: (value: any, key: any) => any, context?: any): any;
|
||||
forEach(obj: any, iterator: (value: any, key: any, obj: any) => void, context?: any): any;
|
||||
|
||||
fromJson(json: string): any;
|
||||
identity<T>(arg?: T): T;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user