import { MaybeAccessor, ElementOf, EffectOnDeps } from '../utils/types.js'; import { Owner } from 'solid-js'; import 'solid-js/types/reactive/signal'; interface UntilToMatchOptions { /** * Milliseconds timeout for promise to resolve/reject if the when condition does not meet. * 0 for never timed out * * @default 0 */ timeout?: number; /** * Reject the promise when timeout * * @default false */ throwOnTimeout?: boolean; } interface UntilBaseInstance { toMatch(condition: (v: T) => v is U, options?: UntilToMatchOptions): Not extends true ? Promise> : Promise; toMatch(condition: (v: T) => boolean, options?: UntilToMatchOptions): Promise; changed: (options?: UntilToMatchOptions) => Promise; changedTimes: (n?: number, options?: UntilToMatchOptions) => Promise; } type Falsy = false | void | null | undefined | 0 | 0n | ''; interface UntilValueInstance extends UntilBaseInstance { readonly not: UntilValueInstance; toBe:

(value: MaybeAccessor

, options?: UntilToMatchOptions) => Not extends true ? Promise : Promise

; toBeTruthy: (options?: UntilToMatchOptions) => Not extends true ? Promise : Promise>; toBeNull: (options?: UntilToMatchOptions) => Not extends true ? Promise> : Promise; toBeUndefined: (options?: UntilToMatchOptions) => Not extends true ? Promise> : Promise; toBeNaN: (options?: UntilToMatchOptions) => Promise; } interface UntilArrayInstance extends UntilBaseInstance { readonly not: UntilArrayInstance; toContains: (value: MaybeAccessor>, options?: UntilToMatchOptions) => Promise; } /** * Promised one-time watch for changes * * @see https://solidjs-use.github.io/solidjs-use/shared/toValue * @example * ``` * const { count } = useCounter() * * await until(count).toMatch(v => v > 7) * * alert('Counter is now larger than 7!') * ``` */ declare function until(r: EffectOnDeps | MaybeAccessor, owner?: Owner | null): UntilArrayInstance; declare function until(r: EffectOnDeps | MaybeAccessor, owner?: Owner | null): UntilValueInstance; export { UntilArrayInstance, UntilBaseInstance, UntilToMatchOptions, UntilValueInstance, until };