/** * Assert that `value` is not undefined or null. * * @param value The value to assert exists * @param message An error message for the thrown error if `value` is undefined or null * @returns The non-null-non-undefined value */ export declare function assert(value: T | undefined | null, message?: string): T; /** * Assert that `value` is a string. * * @param value The value to assert is a string * @param message An error message for the thrown error if `value` is not a string * @returns The string value */ export declare function assertString(value: unknown, message?: string): string; type TypeofMap = { string: string; number: number; bigint: bigint; boolean: boolean; symbol: symbol; undefined: undefined; object: object | null; function: Function; }; /** * Assert that `value` is of the given type. * * @param value The value to assert is of the given type * @param type The type to assert the value is * @param message An error message for the thrown error if `value` is not of the given type * @returns The value */ export declare function assertType(value: unknown, type: K, message?: string): TypeofMap[K]; /** * Assert that `value` is an instance of the given type. * * @param value The value to assert is an instance of the given type * @param type The type to assert the value is an instance of * @param message An error message for the thrown error if `value` is not an instance of the given type * @returns The value */ export declare function assertInstance any>(value: unknown, type: T, message?: string): InstanceType; /** * Assert that `val1` is equal to `val2` by strict comparison. * * Note that `val2` is returned. * * @param val1 The value to compare * @param val2 The value to assert is `val1` is equal to * @param message An error message for the thrown error if `val1` is not equal to `val2` * @returns `val2` */ export declare function assertEquals(val1: unknown, val2: T, message?: string): T; /** * Assert that `value` matches the given predicate. * * @param value The value to assert matches the predicate * @param predicate The predicate to assert the value matches * @param message An error message for the thrown error if `value` does not match the predicate * @returns The value */ export declare function assertPredicate(value: unknown, predicate: (value: unknown) => value is T, message?: string): T; export {};