/** * @template T */ export class Option { /** * @template T * @param {T} value * @returns {Some} */ static some(value: T_1): Some; /** @returns {None} */ static none(): _None; /** * @param {(value: T) => Option} fn * @param {Option} self * @returns {Option} */ static chain(fn: (value: T) => Option, self: Option): Option; /** * @param {(value: T) => bool} fn * @param {Option} self * @returns {Option} */ static filter(predicate: any, self: Option): Option; /** * @template V * @param {(value: T) => V} fn * @param {Option} self * @returns {Option} */ static map(fn: (value: T) => V, self: Option): Option; /** * @param {Option} other * @param {Option} self * @returns {Option} */ static alt(other: Option, self: Option): Option; /** * @param {Option} other * @param {Option} self * @returns {Option} */ static equals(other: Option, self: Option): Option; /** * @param {Option} other * @param {Option} self * @returns {Option} */ static lte(other: Option, self: Option): Option; /** * @returns {this is Some} */ isSome(): this is Some; /** * @returns {this is None} */ isNone(): this is _None; } /** @template T */ export class Some extends Option { /** @param {T} value */ constructor(value: T); /** * @param {(value: T) => Option} fn * @returns {Option} */ andThen(fn: (value: T) => Option): Option; /** * @param {Option} other * @returns {Option} */ and(other: Option): Option; /** * @param {Option} other * @returns {Option} */ or(_other: any): Option; /** * @param {() => Option} other * @returns {Option} */ orElse(_fn: any): Option; /** * @template T * @param {(value: T) => bool} predicate * @returns {Option} */ filter(predicate: (value: T_1) => bool): Option; /** * @param {Option} other * @returns {bool} */ equals(other: Option): bool; /** * @param {Option} other * @returns {bool} */ lte(other: Option): bool; /** * @template [V=T] * @param {(acc: V, value: T) => V} reducer * @param {V} init * @returns {V} */ reduce(reducer: (acc: V, value: T) => V, init: V): V; /** * @returns {Option} */ flatten(): Option; /** * @template V * @param {(value: T) => V} fn * @returns {Option} */ map(fn: (value: T) => V): Option; /** * @template V * @param {V} _default * @param {(value: T) => V} fn * @returns {V} */ mapOr(_default: V, fn: (value: T) => V): V; /** * @template V * @param {() => V} _defaultFn * @param {(value: T) => V} fn * @returns {V} */ mapOrElse(_defaultFn: () => V, fn: (value: T) => V): V; /** * @template E * @param {E} _err * @returns {Result} */ okOr(_err: E): Result; /** * @template E * @template {() => E} F * @param {F} _err * @returns {Result} */ okOrElse E>(_err: F): Result; /** * @param {(value: T) => void} fn * @returns {this} */ inspect(fn: (value: T) => void): this; /** * @returns {T} * @throws {UnwrapError} */ unwrap(): T; /** * @param {T} _value * @returns {T} */ unwrapOr(_value: T): T; /** * @param {() => T} _fn * @returns {T} */ unwrapOrElse(_fn: () => T): T; #private; } export const None: _None; declare class _None extends Option { constructor(); /** * @template T * @param {Option} _other * @returns {Option} */ and(_other: Option): Option; /** * @template T * @template {Option} R * @param {(value: T) => R} fn * @returns {R} */ andThen>(_fn: any): R; /** * @template T * @param {Option} other * @returns {Option} */ or(other: Option): Option; /** * @template T * @param {() => Option} other * @returns {Option} */ orElse(fn: any): Option; /** * @template T * @param {(value: T) => bool} _predicate * @returns {Option} */ filter(_predicate: (value: T) => bool): Option; /** * @template T * @param {Option} other * @returns {bool} */ equals(other: Option): bool; /** * @template T * @param {Option} _other * @returns {bool} */ lte(_other: Option): bool; /** * @template T, [V=T] * @param {(acc: V, value: T) => V} _reducer * @param {V} init * @returns {V} */ reduce(_reducer: (acc: V, value: T) => V, init: V): V; /** * @template T * @template {Option} R * @returns {R} */ flatten>(): R; /** * @template V * @template {Option} R * @param {(value: T) => V} fn * @returns {R} */ map>(_fn: any): R; /** * @template V * @param {V} defaultValue * @param {(value: T) => V} _fn * @returns {V} */ mapOr(defaultValue: V, _fn: (value: T) => V): V; /** * @template V * @param {() => V} defaultFn * @param {(value: T) => V} _fn * @returns {V} */ mapOrElse(defaultFn: () => V, _fn: (value: T) => V): V; /** * @template T, E * @template {Result} R * @param {E} err * @returns {R} */ okOr>(err: E): R; /** * @template T, E * @template {Result} R * @template {() => E} F * @param {F} err * @returns {R} */ okOrElse, F extends () => E>(err: F): R; /** * @template T * @param {(value: T) => void} _fn * @returns {this} */ inspect(_fn: (value: T) => void): this; /** * @template T * @returns {T} * @throws {UnwrapError} */ unwrap(): T; /** * @param {T} value * @returns {T} */ unwrapOr(value: T): T; /** * @template T * @param {() => T} fn * @returns {T} */ unwrapOrElse(fn: () => T): T; } import { Result } from './result.js'; export {}; //# sourceMappingURL=option.d.ts.map