declare function castArray(value: null): T[]; declare function castArray(value: undefined): T[]; declare function castArray(value: readonly T[]): readonly T[]; declare function castArray(value: T[]): T[]; declare function castArray(value: NonNullable): T[]; /** * Converts the given value to an array if it's not already one, or returns an value as-is if it's not defined (i.e. `null` or `undefined`). * @note If the value is already an array, it is returned as-is (same reference). * * @example * ```ts * // Returns `[1, 2, 3]` * castArrayIfDefined([1, 2, 3]) * * // Returns `[42]` * castArrayIfDefined(42) * * // Returns `null` * castArrayIfDefined(null) * * // Returns `undefined` * castArrayIfDefined(undefined) * ``` */ declare function castArrayIfDefined(value: null): null; declare function castArrayIfDefined(value: undefined): undefined; declare function castArrayIfDefined(value: readonly T[]): readonly T[]; declare function castArrayIfDefined(value: T[]): T[]; declare function castArrayIfDefined(value: NonNullable): T[]; export { castArrayIfDefined as a, castArray as c };