From 04f5827aca02436a55129eef6b010e653345e590 Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Mon, 6 Feb 2017 23:41:24 +1100 Subject: [PATCH] Add 'index' parameter to fn in .map and .forEach MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Map — https://github.com/airbnb/enzyme/blob/master/docs/api/ShallowWrapper/map.md - forEach — https://github.com/airbnb/enzyme/blob/master/docs/api/ShallowWrapper/forEach.md --- enzyme/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/enzyme/index.d.ts b/enzyme/index.d.ts index 5502b0eb85..eb77ce21eb 100644 --- a/enzyme/index.d.ts +++ b/enzyme/index.d.ts @@ -329,7 +329,7 @@ interface CommonWrapper { * @param fn A callback to be run for every node in the collection. Should expect a ShallowWrapper as the first * argument, and will be run with a context of the original instance. */ - forEach(fn: (wrapper: this) => any): this; + forEach(fn: (wrapper: this, index: number) => any): this; /** * Maps the current array of nodes to another array. Each node is passed in as a ShallowWrapper to the map @@ -339,7 +339,7 @@ interface CommonWrapper { * to the returned array. Should expect a ShallowWrapper as the first argument, and will be run * with a context of the original instance. */ - map(fn: (wrapper: this) => V): V[]; + map(fn: (wrapper: this, index: number) => V): V[]; /** * Applies the provided reducing function to every node in the wrapper to reduce to a single value. Each node