/** * Simplified assert + route helpers. * * Focus: * - Core throwing assertions (`assert*`) * - `test()` → turn throwing assertion(s) into boolean * - `expect()` → run assertions over a value and return the value * - `fork()` / `forkAsync()` → attach pass/fail handlers * - `fn()` / `fnAsync()` → wrap a function so * AssertError in the callback yields a default value. */ export declare class AssertError extends Error { readonly code: "ASSERT_FAILED"; readonly info?: Record; constructor(message?: string, info?: Record); } export type AssertErrorListener = (error: AssertError) => void; export declare const assertErrorEmitter: { readonly on: (listener: AssertErrorListener) => () => void; readonly off: (listener: AssertErrorListener) => void; readonly once: (listener: AssertErrorListener) => () => void; readonly emit: (error: AssertError) => AssertError; }; export declare function assert(condition: unknown, message?: string, info?: Record): asserts condition; export declare function isFunction(x: unknown): x is (...args: unknown[]) => unknown; /** Returns true if x is Promise-like (has a then method). */ export declare function isPromiseLike(x: unknown): x is PromiseLike; export declare function assertString(x: unknown, message?: string): asserts x is string; export declare function assertNumber(x: unknown, message?: string): asserts x is number; export declare function assertBoolean(x: unknown, message?: string): asserts x is boolean; export declare function assertArray(x: unknown, message?: string): asserts x is T[]; export declare function assertObject(x: unknown, message?: string): asserts x is Record; /** Asserts that x is a plain (non-array) object. */ export declare function assertPlainObject(x: unknown, message?: string): asserts x is Record; /** Ensure a plain (non-array) object and return it typed. */ export declare function expectPlainObject(x: unknown, message?: string): Record; export declare function assertDate(x: unknown, message?: string): asserts x is Date; export declare function assertNonNull(x: T | null, message?: string): asserts x is T; export declare function assertExists(x: T | null | undefined, message?: string): asserts x is T; /** * Asserts that x is a function. * * Narrowing: * - On success, narrows x to (...args:any[]) => unknown. */ export declare function assertFunction(x: unknown, message?: string, info?: Record): asserts x is (...args: unknown[]) => unknown; export declare function isDefined(x: T | undefined): x is T; export declare function isNonNull(x: T | null): x is T; export declare function isPresent(x: T | null | undefined): x is T; export declare function isNotNil(x: T | null | undefined): x is T; /** * Asserts that x is Promise-like (has a then method). * * Narrowing: * - On success, narrows x to PromiseLike. */ export declare function assertPromiseLike(x: unknown, message?: string, info?: Record): asserts x is PromiseLike; export declare function assertDefined(x: T | undefined, message?: string, info?: Record): asserts x is T; export declare function assertPresent(x: T | null | undefined, message?: string, info?: Record): asserts x is T; /** Assert that a value is not null or undefined (aka not nil). */ export declare function assertNotNil(x: T | null | undefined, message?: string): asserts x is T; /** * Expect overloads: * - Factory: given an assertion function, return an `expectX`-style function that * runs the assertion and returns the narrowed value. * - Value mode: run one or more assertion functions against a value and return the value. */ export declare function expect(assertFn: (x: unknown, ...args: A) => asserts x is T): (x: unknown, ...args: A) => T; export declare function expect(value: V, ...assertions: Array<(v: V) => void>): V; export declare function expectString(x: unknown, message?: string): string; export declare function expectNumber(x: unknown, message?: string): number; export declare function expectBoolean(x: unknown, message?: string): boolean; export declare function expectArray(x: unknown, message?: string): T[]; export declare function expectArrayNotEmpty(x: unknown, message?: string): T[]; export declare function expectObject(x: unknown, message?: string): Record; export declare function expectDate(x: unknown, message?: string): Date; export declare function expectNonNull(x: T | null, message?: string): T; export declare function expectExists(x: T | null | undefined, message?: string): T; export declare function expectFunction unknown>(x: unknown, message?: string): F; export declare function expectPromiseLike(x: unknown, message?: string): PromiseLike; export declare function expectDefined(x: T | undefined, message?: string): T; export declare function expectPresent(x: T | null | undefined, message?: string): T; /** Ensure value is not null or undefined and return it. */ export declare function expectNotNil(x: T | null | undefined, message?: string): T; export declare function expectTruthy(x: T, message?: string): Exclude; export declare function expectFalsey(x: unknown, message?: string): null | undefined | false | 0 | ''; export declare function expectStringLength(x: unknown, len: number, message?: string): string; export declare function expectStringLengthAtLeast(x: unknown, n: number, message?: string): string; export declare function expectStringLengthAtMost(x: unknown, n: number, message?: string): string; export declare function expectStringLengthBetween(x: unknown, min: number, max: number, message?: string): string; export declare function expectStringContains(x: unknown, needle: string | RegExp, message?: string): string; export declare function expectStringStartsWith(x: unknown, prefix: string, message?: string): string; export declare function expectStringEndsWith(x: unknown, suffix: string, message?: string): string; export declare function expectStringMatches(x: unknown, re: RegExp, message?: string): string; export declare function expectStringEqualsIgnoreCase(x: unknown, expected: string, message?: string): string; export declare function expectStringIncludesAny(x: unknown, ...needles: string[]): string; export declare function expectStringIncludesAll(x: unknown, ...needles: string[]): string; export declare function expectStringIsJSON(x: unknown, message?: string): string; export declare function expectStringTrimmedNotEmpty(x: unknown, message?: string): string; export declare function expectNonEmptyString(x: unknown, message?: string): string; export declare function expectNonEmptyArray(x: unknown, message?: string): T[]; export declare function expectNumberGreaterThan(x: unknown, n: number, message?: string): number; export declare function expectNumberGreaterOrEqual(x: unknown, n: number, message?: string): number; export declare function expectNumberLessThan(x: unknown, n: number, message?: string): number; export declare function expectNumberLessOrEqual(x: unknown, n: number, message?: string): number; export declare function expectNumberBetween(x: unknown, min: number, max: number, message?: string): number; export declare function expectNumberNotZero(x: unknown, message?: string): number; export declare function expectNumberPositive(x: unknown, message?: string): number; export declare function expectNumberNonNegative(x: unknown, message?: string): number; export declare function expectNumberNegative(x: unknown, message?: string): number; export declare function expectNumberNonPositive(x: unknown, message?: string): number; export declare function expectNumberInteger(x: unknown, message?: string): number; export declare function expectNumberSafeInteger(x: unknown, message?: string): number; export declare function expectNumberApproxEquals(x: unknown, expected: number, epsilon?: number, message?: string): number; export declare function expectArrayLength(x: unknown, len: number, message?: string): T[]; export declare function expectArrayHasAnyOf(x: unknown, items: string[], message?: string): T[]; export declare function expectArrayHasEveryOf(x: unknown, items: string[], message?: string): T[]; export declare function expectArrayItemIsBoolean(x: unknown, i: number, message?: string): T[]; export declare function expectArrayItemIsString(x: unknown, i: number, message?: string): T[]; export declare function expectArrayItemIsNumber(x: unknown, i: number, message?: string): T[]; export declare function expectArrayItemIsObject(x: unknown, i: number, message?: string): T[]; export declare function expectArrayIncludesString(x: unknown, needle: string, message?: string): T[]; export declare function expectArrayIncludesNumber(x: unknown, needle: number, message?: string): T[]; export declare function expectArrayIncludesObject(x: unknown, needle: Record, message?: string): T[]; export declare function expectArrayOnlyHasObjects(x: unknown, message?: string): Record[]; export declare function expectArrayOnlyHasStrings(x: unknown, message?: string): string[]; export declare function expectArrayOnlyHasNumbers(x: unknown, message?: string): number[]; export declare function expectArrayEveryIsFalsy(x: unknown, message?: string): T[]; export declare function expectArrayEveryIsTruthy(x: unknown, message?: string): T[]; export declare function expectArrayUnique(x: unknown, message?: string): T[]; export declare function expectArrayIncludesCondition(x: unknown, predicate: (item: unknown) => boolean, message?: string): T[]; export declare function expectHasKey, K extends string>(obj: unknown, key: K, message?: string): O & Record; export declare function expectHasKeys, const K extends readonly string[]>(obj: unknown, ...keys: K): O & { [P in K[number]]: unknown; }; export declare function expectKeyEquals, K extends keyof O, E>(obj: unknown, key: K, expected: E, message?: string): O & Record; export declare function expectSameKeys(obj: unknown, expected: Record, message?: string): Record; export declare function expectAllKeysFalsy(obj: unknown, message?: string): Record; export declare function expectAllKeysSet(obj: unknown, message?: string): Record; export declare function expectAnyKeyNull(obj: unknown, message?: string): Record; export declare function expectElement(x: unknown, message?: string): Element; export declare function expectHTMLElement(x: unknown, message?: string): HTMLElement; export declare function expectElementTags(x: unknown, tags: readonly K[], message?: string): HTMLElementTagNameMap[K]; export declare const expectDiv: (x: unknown, m?: string) => HTMLDivElement; export declare const expectSpan: (x: unknown, m?: string) => HTMLSpanElement; export declare const expectP: (x: unknown, m?: string) => HTMLParagraphElement; export declare const expectUl: (x: unknown, m?: string) => HTMLUListElement; export declare const expectOl: (x: unknown, m?: string) => HTMLOListElement; export declare const expectLi: (x: unknown, m?: string) => HTMLLIElement; export declare const expectForm: (x: unknown, m?: string) => HTMLFormElement; export declare const expectInput: (x: unknown, m?: string) => HTMLInputElement; export declare const expectTextarea: (x: unknown, m?: string) => HTMLTextAreaElement; export declare const expectButton: (x: unknown, m?: string) => HTMLButtonElement; export declare const expectSelect: (x: unknown, m?: string) => HTMLSelectElement; export declare const expectOption: (x: unknown, m?: string) => HTMLOptionElement; export declare const expectLabel: (x: unknown, m?: string) => HTMLLabelElement; export declare const expectImg: (x: unknown, m?: string) => HTMLImageElement; export declare const expectVideo: (x: unknown, m?: string) => HTMLVideoElement; export declare const expectAudio: (x: unknown, m?: string) => HTMLAudioElement; export declare const expectCanvas: (x: unknown, m?: string) => HTMLCanvasElement; export declare const expectTable: (x: unknown, m?: string) => HTMLTableElement; export declare const expectTHead: (x: unknown, m?: string) => HTMLTableSectionElement; export declare const expectTBody: (x: unknown, m?: string) => HTMLTableSectionElement; export declare const expectTFoot: (x: unknown, m?: string) => HTMLTableSectionElement; export declare const expectTr: (x: unknown, m?: string) => HTMLTableRowElement; export declare const expectTh: (x: unknown, m?: string) => HTMLTableCellElement; export declare const expectTd: (x: unknown, m?: string) => HTMLTableCellElement; export declare function expectSvgElement(x: unknown, message?: string): SVGElement; export declare function expectSvgTag(x: unknown, tag: K, message?: string): SVGElementTagNameMap[K]; export declare const expectSvg: (x: unknown, m?: string) => SVGSVGElement; export declare const expectSvgPath: (x: unknown, m?: string) => SVGPathElement; export declare const expectSvgGroup: (x: unknown, m?: string) => SVGGElement; export declare const expectSvgCircle: (x: unknown, m?: string) => SVGCircleElement; export declare const expectSvgRect: (x: unknown, m?: string) => SVGRectElement; export declare const expectSvgLine: (x: unknown, m?: string) => SVGLineElement; export declare function expectElementHasChildren(x: unknown, message?: string): Element; export declare function expectElementHasChild(x: unknown, message?: string): Element; export declare function expectElementHasChildMatching(x: unknown, selector: string, message?: string): Element; export declare function expectElementHasDescendant(x: unknown, selector: string, message?: string): Element; export declare function expectElementHasAttribute(x: unknown, name: string, message?: string): Element; export declare function expectElementAttributeEquals(x: unknown, name: string, expected: string, message?: string): Element; export declare function expectElementHidden(x: unknown, message?: string): Element; export declare function expectElementVisible(x: unknown, message?: string): Element; export declare function expectDateEarlier(x: unknown, than: Date, message?: string): Date; export declare function expectDateLater(x: unknown, than: Date, message?: string): Date; export declare function expectDateBetween(x: unknown, min: Date, max: Date, message?: string): Date; export declare function expectDateYear(x: unknown, year: number, message?: string): Date; export declare function expectDateBefore(x: unknown, than: Date, message?: string): Date; export declare function expectDateAfter(x: unknown, than: Date, message?: string): Date; export declare function expectDateOnOrBefore(x: unknown, than: Date, message?: string): Date; export declare function expectDateOnOrAfter(x: unknown, than: Date, message?: string): Date; export declare function expectDateBetweenInclusive(x: unknown, min: Date, max: Date, message?: string): Date; export declare function expectDateBetweenExclusive(x: unknown, min: Date, max: Date, message?: string): Date; export declare function expectDateInPast(x: unknown, message?: string): Date; export declare function expectDateInFuture(x: unknown, message?: string): Date; export declare function expectDateWithinPast(x: unknown, ms: number, message?: string): Date; export declare function expectDateWithinFuture(x: unknown, ms: number, message?: string): Date; export declare function expectDateSameYear(x: unknown, other: Date, message?: string): Date; export declare function expectDateSameMonth(x: unknown, other: Date, message?: string): Date; export declare function expectDateSameDay(x: unknown, other: Date, message?: string): Date; /** * Execute an assertion function; return true if it succeeds, false if it throws AssertError. * Non-AssertError exceptions are rethrown (to avoid swallowing real errors). */ export declare function test(assertion: () => void): boolean; export declare function fork(assertion: () => void, onPass: (...args: unknown[]) => void, onFail: (error: AssertError, ...args: unknown[]) => void, ...args: unknown[]): void; export declare function forkAsync(assertion: () => Promise, onPass: (...args: unknown[]) => Promise, onFail: (error: AssertError, ...args: unknown[]) => Promise, ...args: unknown[]): Promise; export type AssertFnOptions = { onError?: (err: AssertError) => void; catchNonAssertErrors?: boolean; }; /** * Wrap a function; if an AssertError occurs inside the callback, return the provided default. * - `defaultValue` can be a value or a thunk receiving `(error, ...args)` * - Non-Assert errors are rethrown */ export declare function fn(defaultValue: R | ((error: AssertError, ...args: A) => R), callback: (...args: A) => R, options?: AssertFnOptions): (...args: A) => R; export declare function fnAsync(defaultValue: R | ((error: AssertError, ...args: A) => R | Promise), callback: (...args: A) => Promise, options?: AssertFnOptions): (...args: A) => Promise; /** * Immediate exec, zero-arg: run `cb` now. On AssertError, return `fallback`. * Optionally catch non-Assert errors and observe via `onError`. */ export declare function fnRun(fallback: T, cb: () => T, options?: AssertFnOptions): T; /** * Immediate async exec, zero-arg: run `cb` now. On AssertError, resolve with `fallback`. * Optionally catch non-Assert errors and observe via `onError`. */ export declare function fnRunAsync(fallback: T, cb: () => Promise, options?: AssertFnOptions): Promise; export declare function assertStringLength(x: unknown, len: number, message?: string): asserts x is string; /** Asserts that x is a string with length >= `n`. */ export declare function assertStringLengthAtLeast(x: unknown, n: number, message?: string): asserts x is string; /** Asserts that x is a string with length <= `n`. */ export declare function assertStringLengthAtMost(x: unknown, n: number, message?: string): asserts x is string; /** Asserts that x is a string with min/max inclusive bounds. */ export declare function assertStringLengthBetween(x: unknown, min: number, max: number, message?: string): asserts x is string; /** Asserts that x is a string containing substring or matching regex. */ export declare function assertStringContains(x: unknown, needle: string | RegExp, message?: string): asserts x is string; /** Asserts that x is a string starting with the given prefix. */ export declare function assertStringStartsWith(x: unknown, prefix: string, message?: string): asserts x is string; /** Asserts that x is a string ending with the given suffix. */ export declare function assertStringEndsWith(x: unknown, suffix: string, message?: string): asserts x is string; /** Asserts that x is a string that matches the regex. */ export declare function assertStringMatches(x: unknown, re: RegExp, message?: string): asserts x is string; /** Asserts that x (string) equals `expected` ignoring case. */ export declare function assertStringEqualsIgnoreCase(x: unknown, expected: string, message?: string): asserts x is string; /** Asserts that x is a string including any of the provided substrings. */ export declare function assertStringIncludesAny(x: unknown, ...needles: string[]): asserts x is string; /** Asserts that x is a string including all of the provided substrings. */ export declare function assertStringIncludesAll(x: unknown, ...needles: string[]): asserts x is string; /** Asserts that x is a string containing valid JSON. */ export declare function assertStringIsJSON(x: unknown, message?: string): asserts x is string; /** Asserts that x is a string whose trimmed length > 0. */ export declare function assertStringTrimmedNotEmpty(x: unknown, message?: string): asserts x is string; /** Asserts that x is a number strictly greater than n. */ export declare function assertNumberGreaterThan(x: unknown, n: number, message?: string): asserts x is number; /** Asserts that x is a number >= n. */ export declare function assertNumberGreaterOrEqual(x: unknown, n: number, message?: string): asserts x is number; /** Asserts that x is a number strictly less than n. */ export declare function assertNumberLessThan(x: unknown, n: number, message?: string): asserts x is number; /** Asserts that x is a number <= n. */ export declare function assertNumberLessOrEqual(x: unknown, n: number, message?: string): asserts x is number; /** Asserts that x is a number within [min, max]. */ export declare function assertNumberBetween(x: unknown, min: number, max: number, message?: string): asserts x is number; /** Asserts that x is an array with exact length `len`. */ export declare function assertArrayLength(x: unknown, len: number, message?: string): asserts x is T[]; /** Asserts that x is a non-empty array. */ export declare function assertArrayNotEmpty(x: unknown, message?: string): asserts x is T[]; /** Asserts that x is an array containing at least one of the provided items (by string form). */ export declare function assertArrayHasAnyOf(x: unknown, items: string[], message?: string): asserts x is T[]; /** Asserts that x is an array containing all the provided items (by string form). */ export declare function assertArrayHasEveryOf(x: unknown, items: string[], message?: string): asserts x is T[]; /** Asserts that x is an array and element at index i is a boolean. */ export declare function assertArrayItemIsBoolean(x: unknown, i: number, message?: string): asserts x is T[]; /** Asserts that x is an array and element at index i is a string. */ export declare function assertArrayItemIsString(x: unknown, i: number, message?: string): asserts x is T[]; /** Asserts that x is an array and element at index i is a number. */ export declare function assertArrayItemIsNumber(x: unknown, i: number, message?: string): asserts x is T[]; /** Asserts that x is an array and element at index i is a plain object. */ export declare function assertArrayItemIsObject(x: unknown, i: number, message?: string): asserts x is T[]; /** Asserts that x is an array with at least one item whose string form includes `needle`. */ export declare function assertArrayIncludesString(x: unknown, needle: string, message?: string): asserts x is T[]; /** Asserts that x is an array including the exact number `needle`. */ export declare function assertArrayIncludesNumber(x: unknown, needle: number, message?: string): asserts x is T[]; /** Asserts that x is an array including an object deep-equal to `needle`. */ export declare function assertArrayIncludesObject(x: unknown, needle: Record, message?: string): asserts x is T[]; /** Asserts that x is an array whose every element is a plain object. */ export declare function assertArrayOnlyHasObjects(x: unknown, message?: string): asserts x is Record[]; /** Asserts that x is an array whose every element is a string. */ export declare function assertArrayOnlyHasStrings(x: unknown, message?: string): asserts x is string[]; /** Asserts that x is an array whose every element is a number. */ export declare function assertArrayOnlyHasNumbers(x: unknown, message?: string): asserts x is number[]; /** Asserts that x is an array and every element is falsy. */ export declare function assertArrayEveryIsFalsy(x: unknown, message?: string): asserts x is T[]; /** Asserts that x is an array and every element is truthy. */ export declare function assertArrayEveryIsTruthy(x: unknown, message?: string): asserts x is T[]; /** Assert an array has all unique items by strict equality (===). */ export declare function assertArrayUnique(x: unknown, message?: string): asserts x is T[]; /** Asserts that x is an array including an element for which predicate returns true. */ export declare function assertArrayIncludesCondition(x: unknown, predicate: (item: unknown) => boolean, message?: string): asserts x is T[]; /** Asserts that obj is a plain object containing the provided key. */ export declare function assertHasKey, K extends string>(obj: unknown, key: K, message?: string): asserts obj is O & Record; /** Asserts that obj is a plain object containing all provided keys. */ export declare function assertHasKeys, const K extends readonly string[]>(obj: unknown, ...keys: K): asserts obj is O & { [P in K[number]]: unknown; }; /** Asserts that obj[key] strictly equals expected. */ export declare function assertKeyEquals, K extends keyof O, E>(obj: unknown, key: K, expected: E, message?: string): asserts obj is O & Record; /** Asserts that obj has exactly the same set of keys as `expected`. */ export declare function assertSameKeys(obj: unknown, expected: Record, message?: string): asserts obj is Record; /** Asserts that `obj` contains at least all keys present in `other`. */ export declare function assertHasAllKeysLike>(obj: unknown, other: O, message?: string): asserts obj is Record & { [P in keyof O]: unknown; }; /** Ensure `obj` has all keys like `other` and return it with narrowed key presence. */ export declare function expectHasAllKeysLike>(obj: unknown, other: O, message?: string): Record & { [P in keyof O]: unknown; }; /** Asserts that obj is a plain object with at least one own key. */ export declare function assertNonEmptyRecord(obj: unknown, message?: string): asserts obj is Record; /** Ensure obj is a plain object with at least one own key and return it typed. */ export declare function expectNonEmptyRecord(obj: unknown, message?: string): Record; /** Asserts that every value in obj is falsy. */ export declare function assertAllKeysFalsy(obj: unknown, message?: string): asserts obj is Record; /** Asserts that every value in obj is neither null nor undefined. */ export declare function assertAllKeysSet(obj: unknown, message?: string): asserts obj is Record; export declare function assertExpected InstanceType | never>(x: unknown, ctor: C, asst?: (v: InstanceType) => boolean): InstanceType; /** Asserts that at least one value in obj is null. */ export declare function assertAnyKeyNull(obj: unknown, message?: string): asserts obj is Record; /** Type guard: returns true if `x` is an instance of `ctor`. */ export declare function isInstanceOf(x: unknown, ctor: new (...args: unknown[]) => T): x is T; /** Asserts that `x` is an instance of the given constructor. */ export declare function assertInstanceOf(x: unknown, ctor: new (...args: unknown[]) => T, message?: string): asserts x is T; /** Ensure `x` is an instance of the given constructor and return it typed. */ export declare function expectInstanceOf(x: unknown, ctor: new (...args: unknown[]) => T, message?: string): T; /** Returns true if x is a DOM Element (when running in an environment with DOM). */ export declare function isElement(x: unknown): x is Element; /** Asserts that x is a DOM Element. */ export declare function assertElement(x: unknown, message?: string): asserts x is Element; /** Asserts that x is a DOM HTML Element. */ export declare function assertHTMLElement(x: unknown, message?: string): asserts x is HTMLElement; /** Asserts that the element has at least one child node/element. */ export declare function assertElementHasChildren(x: unknown, message?: string): asserts x is Element; /** Asserts that the element has at least one child element. */ export declare function assertElementHasChild(x: unknown, message?: string): asserts x is Element; /** Asserts that the element has a child matching the CSS selector. */ export declare function assertElementHasChildMatching(x: unknown, selector: string, message?: string): asserts x is Element; /** Asserts that the element has a descendant matching the CSS selector. */ export declare function assertElementHasDescendant(x: unknown, selector: string, message?: string): asserts x is Element; /** Asserts that the element has the given attribute. */ export declare function assertElementHasAttribute(x: unknown, name: string, message?: string): asserts x is Element; /** Asserts that the element's attribute equals the expected value. */ export declare function assertElementAttributeEquals(x: unknown, name: string, expected: string, message?: string): asserts x is Element; /** Returns true if the Element is hidden via display:none or visibility:hidden (DOM environments). */ export declare function isElementHidden(x: unknown): x is Element; /** Returns true if the Element is visible (i.e., not hidden by display/visibility). */ export declare function isElementVisible(x: unknown): x is Element; /** Asserts that x is an Element currently hidden by CSS (display or visibility). */ export declare function assertElementHidden(x: unknown, message?: string): asserts x is Element; /** Asserts that x is an Element currently visible (not hidden by display/visibility). */ export declare function assertElementVisible(x: unknown, message?: string): asserts x is Element; /** Asserts that x is a Date earlier than `than`. */ export declare function assertDateEarlier(x: unknown, than: Date, message?: string): asserts x is Date; /** Asserts that x is a Date later than `than`. */ export declare function assertDateLater(x: unknown, than: Date, message?: string): asserts x is Date; /** Asserts that x is a Date within [min, max]. */ export declare function assertDateBetween(x: unknown, min: Date, max: Date, message?: string): asserts x is Date; /** Asserts that x is a Date whose full year equals `year`. */ export declare function assertDateYear(x: unknown, year: number, message?: string): asserts x is Date; /** Supported canonical date formats */ export type DateFormat = 'ISO' | 'UNIX_MS' | 'UNIX_S' | 'RFC_2822'; /** Asserts that the input matches the expected date format shape. */ export declare function assertDateFormat(input: unknown, format: DateFormat, message?: string): void; /** Converts input of a given format to a Date (throws AssertError on failure). */ export declare function DateFromFormat(format: DateFormat, input: unknown, message?: string): Date; /** Convenience: ensure date-like input, accepting several formats. */ export declare function DateEnsure(input: unknown, message?: string, formats?: DateFormat[]): Date; export declare function assertDateBefore(x: unknown, than: Date, message?: string): asserts x is Date; export declare function assertDateAfter(x: unknown, than: Date, message?: string): asserts x is Date; export declare function assertDateOnOrBefore(x: unknown, than: Date, message?: string): asserts x is Date; export declare function assertDateOnOrAfter(x: unknown, than: Date, message?: string): asserts x is Date; export declare function assertDateBetweenInclusive(x: unknown, min: Date, max: Date, message?: string): asserts x is Date; export declare function assertDateBetweenExclusive(x: unknown, min: Date, max: Date, message?: string): asserts x is Date; export declare function assertDateInPast(x: unknown, message?: string): asserts x is Date; export declare function assertDateInFuture(x: unknown, message?: string): asserts x is Date; export declare function assertDateWithinPast(x: unknown, ms: number, message?: string): asserts x is Date; export declare function assertDateWithinFuture(x: unknown, ms: number, message?: string): asserts x is Date; export declare function assertDateSameYear(x: unknown, other: Date, message?: string): asserts x is Date; export declare function assertDateSameMonth(x: unknown, other: Date, message?: string): asserts x is Date; export declare function assertDateSameDay(x: unknown, other: Date, message?: string): asserts x is Date; export type TimeSpan = { ms: number; }; export declare function TimeSpanFromMs(ms: number): TimeSpan; export declare function TimeSpanFromSeconds(s: number): TimeSpan; export declare function TimeSpanFromMinutes(m: number): TimeSpan; export declare function TimeSpanFromHours(h: number): TimeSpan; export declare function TimeSpanFromDays(d: number): TimeSpan; export declare function DateTimeSpanBetween(a: Date, b: Date): TimeSpan; export declare function assertDateTimeSpanLessThan(a: Date, b: Date, limit: TimeSpan, message?: string): void; export declare function assertDateTimeSpanLessOrEqual(a: Date, b: Date, limit: TimeSpan, message?: string): void; export declare function assertDateBetweenWithin(a: Date, b: Date, min: TimeSpan, max: TimeSpan, message?: string): void; export declare function DateAddSpan(d: Date, span: TimeSpan): Date; export declare function DateSubtractSpan(d: Date, span: TimeSpan): Date; /** Asserts that x is strictly true. */ export declare function assertTrue(x: unknown, message?: string): asserts x is true; /** Asserts that x is strictly false. */ export declare function assertFalse(x: unknown, message?: string): asserts x is false; /** Asserts that x is strictly null. */ export declare function assertNull(x: unknown, message?: string): asserts x is null; /** Asserts that x is strictly undefined. */ export declare function assertUndefined(x: unknown, message?: string): asserts x is undefined; /** Asserts that x is truthy; narrows away null/undefined/false/0/'' */ export declare function assertTruthy(x: T, message?: string): asserts x is Exclude; /** Asserts that x is falsy (null/undefined/false/0/''). */ export declare function assertFalsey(x: unknown, message?: string): asserts x is null | undefined | false | 0 | ''; /** Asserts that x is a number not equal to 0. */ export declare function assertNumberNotZero(x: unknown, message?: string): asserts x is number; /** Asserts that x is a number strictly greater than 0. */ export declare function assertNumberPositive(x: unknown, message?: string): asserts x is number; /** Asserts that x is a number >= 0. */ export declare function assertNumberNonNegative(x: unknown, message?: string): asserts x is number; /** Asserts that x is a number strictly less than 0. */ export declare function assertNumberNegative(x: unknown, message?: string): asserts x is number; /** Asserts that x is a number <= 0. */ export declare function assertNumberNonPositive(x: unknown, message?: string): asserts x is number; /** Asserts that x is an integer (Number.isInteger). */ export declare function assertNumberInteger(x: unknown, message?: string): asserts x is number; /** Asserts that x is a safe integer (Number.isSafeInteger). */ export declare function assertNumberSafeInteger(x: unknown, message?: string): asserts x is number; /** Asserts that x is a number within ±epsilon of expected. */ export declare function assertNumberApproxEquals(x: unknown, expected: number, epsilon?: number, message?: string): asserts x is number; /** Asserts that x is an array of objects and each object contains `key`. */ export declare function assertObjectArrayAllHaveKey(x: unknown, key: K, message?: string): asserts x is Array & Record>; /** Asserts that x is an array of objects and each object contains all provided keys. */ export declare function assertObjectArrayEveryHasKeys(x: unknown, ...keys: K): asserts x is Array & { [P in K[number]]: unknown; }>; export declare function expectObjectArrayEveryHasKeys(x: unknown, ...keys: K): Array & { [P in K[number]]: unknown; }>; /** Asserts referential/primitive equality (===). */ export declare function assertEquals(actual: T, expected: T, message?: string): void; /** Asserts non-equality (!==). */ export declare function assertNotEquals(actual: T, expected: T, message?: string): void; /** Asserts deep equality using a simple structural comparison (arrays, objects, dates). */ export declare function assertDeepEquals(actual: T, expected: T, message?: string): void; export declare function _fn(defaultValue: R, impl: (...args: Args | []) => R): (...args: Args) => R; export declare function _fnAsync(defaultValue: R, impl: (...args: Args | []) => Promise): (...args: Args) => Promise; export type AssertErrorTrapOptions = { onError?: (err: AssertError) => void; /** When true (or returns true), unhandled AssertErrors are suppressed (prevent process/page break). */ suppress?: boolean | ((err: AssertError) => boolean); }; export declare function installAssertErrorHandler(options?: AssertErrorTrapOptions): { readonly uninstall: () => void; }; //# sourceMappingURL=assertjunky.d.ts.map