Skip to content

Commit 1ea2afe

Browse files
committed
fix(types): changed callback signature on waitFor to match old types
1 parent 5471a34 commit 1ea2afe

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Diff for: .eslintrc

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"import/no-unresolved": "off",
99
"react-hooks/rules-of-hooks": "off",
1010
"@typescript-eslint/no-floating-promises": "off",
11-
"@typescript-eslint/no-unnecessary-condition": "off"
11+
"@typescript-eslint/no-unnecessary-condition": "off",
12+
"@typescript-eslint/no-invalid-void-type": "off"
1213
},
1314
"parserOptions": {
1415
"project": ["./tsconfig.json", "./test/tsconfig.json"]

Diff for: src/asyncUtils.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ function asyncUtils(addResolver: (callback: () => void) => void) {
4242
await nextUpdatePromise
4343
}
4444

45-
const waitFor = async <T>(
46-
callback: () => T | Promise<T>,
45+
const waitFor = async (
46+
callback: () => boolean | void,
4747
{ interval, timeout, suppressErrors = true }: WaitOptions = {}
4848
) => {
4949
const checkResult = () => {
5050
try {
5151
const callbackResult = callback()
52-
return callbackResult || callbackResult === undefined
52+
return callbackResult ?? callbackResult === undefined
5353
} catch (error: unknown) {
5454
if (!suppressErrors) {
5555
throw error as Error

0 commit comments

Comments
 (0)