From aae346fe6e88be2931eeddf03dca99aa78dc2aa5 Mon Sep 17 00:00:00 2001 From: Stephen Niedzielski Date: Tue, 19 Feb 2019 19:02:05 -0700 Subject: [PATCH] [jest-each] Update: templatize .each() - Replace `any` with templates. - Update Jest website to fix failing test. fix #33079 --- types/jest/index.d.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/types/jest/index.d.ts b/types/jest/index.d.ts index 29b3210cc2..b5ee488b2b 100644 --- a/types/jest/index.d.ts +++ b/types/jest/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Jest 24.0 -// Project: http://facebook.github.io/jest/ +// Project: https://jestjs.io // Definitions by: Asana // Ivo Stratev // jwbay @@ -263,7 +263,20 @@ declare namespace jest { } interface Each { - (cases: any[]): (name: string, fn: (...args: any[]) => any) => void; + // Exclusively arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T) => any + ) => void; + // Not arrays. + (cases: ReadonlyArray): ( + name: string, + fn: (...args: T[]) => any + ) => void; + (cases: ReadonlyArray>): ( + name: string, + fn: (...args: any[]) => any + ) => void; (strings: TemplateStringsArray, ...placeholders: any[]): ( name: string, fn: (arg: any) => any