Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

‎.eslintrc

Lines changed: 2 additions & 1 deletion
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"]

‎src/asyncUtils.ts

Lines changed: 3 additions & 3 deletions
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)

AltStyle によって変換されたページ (->オリジナル) /