diff --git a/.eslintrc b/.eslintrc index 052c9caa..b16789bf 100644 --- a/.eslintrc +++ b/.eslintrc @@ -8,7 +8,8 @@ "import/no-unresolved": "off", "react-hooks/rules-of-hooks": "off", "@typescript-eslint/no-floating-promises": "off", - "@typescript-eslint/no-unnecessary-condition": "off" + "@typescript-eslint/no-unnecessary-condition": "off", + "@typescript-eslint/no-invalid-void-type": "off" }, "parserOptions": { "project": ["./tsconfig.json", "./test/tsconfig.json"] diff --git a/src/asyncUtils.ts b/src/asyncUtils.ts index 22921721..c5aede4e 100644 --- a/src/asyncUtils.ts +++ b/src/asyncUtils.ts @@ -42,14 +42,14 @@ function asyncUtils(addResolver: (callback: () => void) => void) { await nextUpdatePromise } - const waitFor = async ( - callback: () => T | Promise, + const waitFor = async ( + callback: () => boolean | void, { interval, timeout, suppressErrors = true }: WaitOptions = {} ) => { const checkResult = () => { try { const callbackResult = callback() - return callbackResult || callbackResult === undefined + return callbackResult ?? callbackResult === undefined } catch (error: unknown) { if (!suppressErrors) { throw error as Error