From b576d4b61659562fc599c98dee4b1ff84d7c38de Mon Sep 17 00:00:00 2001 From: Sarah Dayan Date: Mon, 23 Dec 2019 17:32:53 +0100 Subject: [PATCH] Add missing type information for v3.2 of react-hooks-testing-library (#41028) * feat: add typing for waitForValueToChange * chore: add attribution and update version * feat: add typing for wait method * fix: remove disallowed path version * fix: add missing generic name * fix: add missing generic name * fix: remove generic considered unnecessary * fix: add missing WaitOptions in waitForNextUpdate --- types/testing-library__react-hooks/index.d.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/types/testing-library__react-hooks/index.d.ts b/types/testing-library__react-hooks/index.d.ts index 3e273488b8..d6a3daf40f 100644 --- a/types/testing-library__react-hooks/index.d.ts +++ b/types/testing-library__react-hooks/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for @testing-library/react-hooks 3.1 +// Type definitions for @testing-library/react-hooks 3.2 // Project: https://github.com/testing-library/react-hooks-testing-library // Definitions by: Michael Peyper +// Sarah Dayan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -17,9 +18,16 @@ export interface HookResult { readonly error: Error; } +export interface WaitOptions { + timeout?: number; + suppressErrors?: boolean; +} + export interface RenderHookResult { readonly result: HookResult; - readonly waitForNextUpdate: () => Promise; + readonly waitForNextUpdate: (options?: WaitOptions) => Promise; + readonly waitForValueToChange: (selector: () => any, options?: WaitOptions) => Promise; + readonly wait: (callback: () => boolean|void, options?: WaitOptions) => Promise; readonly unmount: () => boolean; readonly rerender: (newProps?: P) => void; }