import { AnyConstructor, AnyFunction, AnyJson, Dictionary, JsonArray, JsonMap, Optional } from '../types'; /** * Narrows an `unknown` value to a `string` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asString(value: unknown): Optional; /** * Narrows an `unknown` value to a `string` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asString(value: unknown, defaultValue: string): string; /** * Narrows an `unknown` value to a `number` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asNumber(value: unknown): Optional; /** * Narrows an `unknown` value to a `number` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asNumber(value: unknown, defaultValue: number): number; /** * Narrows an `unknown` value to a `boolean` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asBoolean(value: unknown): Optional; /** * Narrows an `unknown` value to a `boolean` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asBoolean(value: unknown, defaultValue: boolean): boolean; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asObject(value: unknown): Optional; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asObject(value: unknown, defaultValue: T): T; /** * Narrows an `unknown` value to a plain `object` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asPlainObject(value: unknown): Optional; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asPlainObject(value: unknown, defaultValue: T): T; /** * Narrows an `unknown` value to a `Dictionary` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asDictionary(value: unknown): Optional>; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asDictionary(value: unknown, defaultValue: Dictionary): Dictionary; /** * Narrows an `unknown` value to an instance of constructor type `T` if it is type-compatible, or returns `undefined` * otherwise. * * @param value The value to test. */ export declare function asInstance(value: unknown, ctor: C): Optional>; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asInstance(value: unknown, ctor: C, defaultValue: InstanceType): InstanceType; /** * Narrows an `unknown` value to an `Array` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asArray(value: unknown): Optional; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asArray(value: unknown, defaultValue: T[]): T[]; /** * Narrows an `unknown` value to an `AnyFunction` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asFunction(value: unknown): Optional; /** * Narrows an `unknown` value to an `object` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asFunction(value: unknown, defaultValue: AnyFunction): AnyFunction; /** * Narrows an `AnyJson` value to a `JsonMap` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asJsonMap(value: Optional): Optional; /** * Narrows an `AnyJson` value to a `JsonMap` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if `value` was undefined or of the incorrect type. */ export declare function asJsonMap(value: Optional, defaultValue: JsonMap): JsonMap; /** * Narrows an `AnyJson` value to a `JsonArray` if it is type-compatible, or returns `undefined` otherwise. * * @param value The value to test. */ export declare function asJsonArray(value: Optional): Optional; /** * Narrows an `AnyJson` value to a `JsonArray` if it is type-compatible, or returns the provided default otherwise. * * @param value The value to test. * @param defaultValue The default to return if the value was undefined or of the incorrect type. */ export declare function asJsonArray(value: Optional, defaultValue: JsonArray): JsonArray;