declare class Optional { private static readonly EMPTY; private readonly value; constructor(value: T | undefined); /** * Retrieves the value if it's present, otherwise returns undefined. * @returns The value if present, otherwise undefined. */ get(): T | undefined; /** * Checks if the value is present. * @returns True if the value is present, false otherwise. */ isPresent(): boolean; /** * Retrieves the value if it's present, otherwise returns a specified default value. * @param other The default value to return if the value is absent. * @returns The value if present, otherwise the specified default value. */ orElse(other: T): T; /** * Maps the value to a new value if present, otherwise returns an empty Optional. * @param mapper A function to transform the value. * @returns An Optional containing the transformed value if present, otherwise an empty Optional. */ map(mapper: (value: T) => U): Optional; /** * Maps the value to a new Optional if present, otherwise returns an empty Optional. * Then applies a function to the value and flattens the result. * @param mapper A function to transform the value and return an Optional. * @returns An Optional containing the transformed value if present, otherwise an empty Optional. */ flatMap(mapper: (value: T) => Optional): Optional; /** * Applies a function to the value if present, otherwise does nothing. * @param consumer A function to apply to the value if present. */ ifPresent(consumer: (value: T) => void): void; /** * Filters the value based on a predicate function. * @param predicate A function to test the value. * @returns An Optional containing the value if it passes the predicate, otherwise an empty Optional. */ filter(predicate: (value: T) => boolean): Optional; /** * Returns an empty Optional. * @returns An empty Optional instance. */ static empty(): Optional; /** * Returns a new Optional with a value if it's present, otherwise an empty Optional. * @param value The value to wrap. * @returns An Optional containing the value if not undefined, otherwise an empty Optional. */ static of(value: T | undefined): Optional; static ofNullable(value: T | undefined | null): Optional; } export default Optional;