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
This commit is contained in:
Sarah Dayan
2019-12-23 10:32:53 -06:00
committed by Andrew Branch
parent 93901a2c0d
commit b576d4b616
+10 -2
View File
@@ -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 <https://github.com/mpeyper>
// Sarah Dayan <https://github.com/sarahdayan>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
@@ -17,9 +18,16 @@ export interface HookResult<R> {
readonly error: Error;
}
export interface WaitOptions {
timeout?: number;
suppressErrors?: boolean;
}
export interface RenderHookResult<P, R> {
readonly result: HookResult<R>;
readonly waitForNextUpdate: () => Promise<void>;
readonly waitForNextUpdate: (options?: WaitOptions) => Promise<void>;
readonly waitForValueToChange: (selector: () => any, options?: WaitOptions) => Promise<void>;
readonly wait: (callback: () => boolean|void, options?: WaitOptions) => Promise<void>;
readonly unmount: () => boolean;
readonly rerender: (newProps?: P) => void;
}