/** * @template T */ export class Option { /** * @template T * @param {T} value * @returns {Some} */ static some(value: T_1): Some; /** @returns {None} */ static none(): _None; /** * @template T * @param {(value: T) => Option} fn * @param {Option} self * @returns {Option} */ static chain(fn: (value: T_1) => Option, self: Option): Option; /** * @template T * @param {(value: T) => boolean} predicate * @param {Option} self * @returns {Option} */ static filter(predicate: (value: T_1) => boolean, self: Option): Option; /** * @template T,V * @param {(value: T) => V} fn * @param {Option} self * @returns {Option} */ static map(fn: (value: T_1) => V, self: Option): Option; /** * @template T * @param {Option} other * @param {Option} self * @returns {Option} */ static alt(other: Option, self: Option): Option; /** * @template T * @param {Option} other * @param {Option} self * @returns {Option} */ static equals(other: Option, self: Option): Option; /** * @template T * @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; /** * @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: Option): Option; /** * @param {() => Option} _fn * @returns {Option} */ orElse(_fn: () => Option): Option; /** * @param {(value: T) => boolean} predicate * @returns {Option} */ filter(predicate: (value: T) => boolean): Option; /** * @param {Option} other * @returns {boolean} */ equals(other: Option): boolean; /** * @param {Option} other * @returns {boolean} */ lte(other: Option): boolean; /** * @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 * @param {() => E} _err * @returns {Result} */ okOrElse(_err: () => E): 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; } /** * @template T * @augments Option */ export class Some extends Option { /** @param {T} value */ constructor(value: T); /** * @returns {this is Some} */ isSome(): this is Some; /** * @returns {this is _None} */ isNone(): this is _None; /** * @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: Option): Option; /** * @param {() => Option} _fn * @returns {Option} */ orElse(_fn: () => Option): Option; /** * @param {(value: T) => boolean} predicate * @returns {Option} */ filter(predicate: (value: T) => boolean): Option; /** * @param {Option} other * @returns {boolean} */ equals(other: Option): boolean; /** * @param {Option} other * @returns {boolean} */ lte(other: Option): boolean; /** * @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 * @param {() => E} _err * @returns {Result} */ okOrElse(_err: () => E): 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; /** * @template T * @augments Option */ declare class _None extends Option { /** * @returns {this is Some} */ isSome(): this is Some; /** * @returns {this is _None} */ isNone(): this is _None; /** * @param {Option} _other * @returns {Option} */ and(_other: Option): Option; /** * @template {Option} R * @param {(value: T) => R} _fn * @returns {R} */ andThen>(_fn: (value: T) => R): R; /** * @param {Option} other * @returns {Option} */ or(other: Option): Option; /** * @param {() => Option} fn * @returns {Option} */ orElse(fn: () => Option): Option; /** * @param {(value: T) => boolean} _predicate * @returns {Option} */ filter(_predicate: (value: T) => boolean): Option; /** * @param {Option} other * @returns {boolean} */ equals(other: Option): boolean; /** * @param {Option} _other * @returns {boolean} */ lte(_other: Option): boolean; /** * @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; /** * @template {Option} R * @returns {R} */ flatten>(): R; /** * @template V * @param {(value: T) => V} _fn * @returns {Option} */ map(_fn: (value: T) => V): Option; /** * @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 E * @template {Result} R * @param {E} err * @returns {R} */ okOr>(err: E): R; /** * @template E * @param {() => E} err * @returns {Result} */ okOrElse(err: () => E): 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; } import { Result } from './result.js'; export { }; //# sourceMappingURL=option.d.ts.map