import { AnyArray, AnyConstructor, AnyFunction, AnyJson, JsonArray, JsonMap, Nullable, Optional, Dictionary } from '../types'; /** * Asserts that a given `condition` is true, or raises an error otherwise. * * @param condition The condition to test. * @param message The error message to use if the condition is false. * @throws {@link AssertionFailedError} If the assertion failed. */ export declare function assert(condition: boolean, message?: string): asserts condition; /** * Narrows a type `Nullable` to a `T` or raises an error. * * Use of the type parameter `T` to further narrow the type signature of the value being tested is * strongly discouraged unless you are completely confident that the value is of the necessary shape to * conform with `T`. This function does nothing at either compile time or runtime to prove the value is of * shape `T`, so doing so amounts to nothing more than performing a type assertion, which is generally a * bad practice unless you have performed some other due diligence in proving that the value must be of * shape `T`. Use of the functions in the `has` co-library are useful for performing such full or partial * proofs. * * @param value The value to test. * @param message The error message to use if `value` is `undefined` or `null`. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertNonNull(value: Nullable, message?: string): asserts value is T; /** * Narrows an `unknown` value to a `string` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertString(value: unknown, message?: string): asserts value is string; /** * Narrows an `unknown` value to a `number` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertNumber(value: unknown, message?: string): asserts value is number; /** * Narrows an `unknown` value to a `boolean` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertBoolean(value: unknown, message?: string): asserts value is boolean; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertObject(value: unknown, message?: string): asserts value is T; /** * Narrows an `unknown` value to an `object` if it is type-compatible and tests positively with {@link isPlainObject}, * or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertPlainObject(value: unknown, message?: string): asserts value is T; /** * Narrows an `unknown` value to a `Dictionary` if it is type-compatible and tests positively * with {@link isDictionary}, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertDictionary(value: unknown, message?: string): asserts value is Dictionary; /** * Narrows an `unknown` value to instance of constructor type `T` if it is type-compatible, or raises an error * otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertInstance(value: unknown, ctor: C, message?: string): asserts value is InstanceType; /** * Narrows an `unknown` value to an `Array` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertArray(value: unknown, message?: string): asserts value is AnyArray; /** * Narrows an `unknown` value to an `AnyFunction` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertFunction(value: unknown, message?: string): asserts value is AnyFunction; /** * Narrows an `unknown` value to an `AnyJson` if it is type-compatible, or returns `undefined` otherwise. * * See also caveats noted in {@link isAnyJson}. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was not a JSON value type. */ export declare function assertAnyJson(value: unknown, message?: string): asserts value is AnyJson; /** * Narrows an `AnyJson` value to a `JsonMap` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertJsonMap(value: Optional, message?: string): asserts value is JsonMap; /** * Narrows an `AnyJson` value to a `JsonArray` if it is type-compatible, or raises an error otherwise. * * @param value The value to test. * @param message The error message to use if `value` is not type-compatible. * @throws {@link AssertionFailedError} If the value was undefined. */ export declare function assertJsonArray(value: Optional, message?: string): asserts value is JsonArray;