@@ -222,9 +222,9 @@ interface WaitUntilOptions {
222222 /** A backoff multiplier for how long the next interval will be (default: None, i.e 1) */
223223 readonly backoff ?: number
224224 /**
225- * Only retries when an error is thrown, otherwise returning the result regardless of truthiness .
226- * - Ignores 'truthy' arg
227- * - If the timeout is reached it will throw the last error
225+ * Only retries when an error is thrown, otherwise returning the immediate result .
226+ * - 'truthy' arg is ignored
227+ * - If the timeout is reached it throws the last error
228228 * - default: false
229229 */
230230 readonly retryOnFail ?: boolean
@@ -234,14 +234,13 @@ export const waitUntilDefaultTimeout = 2000
234234export const waitUntilDefaultInterval = 500
235235
236236/**
237- * Invokes `fn()` until it returns a truthy value (or non-undefined if `truthy:false`).
238- *
239- * Also look at {@link withRetries} to be able to retry on failures.
237+ * Invokes `fn()` on an interval based on the given arguments. This can be used for retries, or until
238+ * an expected result is given. Read {@link WaitUntilOptions} carefully.
240239 *
241240 * @param fn Function whose result is checked
242241 * @param options See {@link WaitUntilOptions}
243242 *
244- * @returns Result of `fn()`, or `undefined` if timeout was reached .
243+ * @returns Result of `fn()`, or possibly `undefined` depending on the arguments .
245244 */
246245export async function waitUntil < T > ( fn : ( ) => Promise < T > , options : WaitUntilOptions & { retryOnFail : true } ) : Promise < T >
247246export async function waitUntil < T > (
@@ -308,7 +307,7 @@ export async function waitUntil<T>(fn: () => Promise<T>, options: WaitUntilOptio
308307 throw lastError
309308 }
310309
311- // when testing, this saves the need to progress the stubbed clock
310+ // when testing, this avoids the need to progress the stubbed clock
312311 if ( interval > 0 ) {
313312 await sleep ( interval )
314313 }
0 commit comments