import type { As, Default, Either, Fn, FnReturn, Monad, None, none_tag, NoneError, Option, PartialEq, Result, Shunt, some_tag } from '../../../mod.js'; type OptionIntoFlag = 'result' | 'either'; export interface option extends Monad, As, PartialEq { readonly _tag: typeof some_tag | typeof none_tag; /** 是否为Some */ readonly is_some: boolean; /** 是否为None */ readonly is_none: boolean; /** ### unwrap : 获取值,如果为`None`就抛异:{@link NoneError} */ unwrap(): T; /** ### expect : 获取值抛异,如果为`None`就抛异,err作为错误抛出 */ expect(err: E): T; /** ### unwrap_or : 获取值,如果为None就返回`def` */ unwrap_or(def: R): T | R; /** ### unwrap_or_else : 获取值,如果为`None`就执行fn */ unwrap_or_else(fn: FnReturn): T | R; /** ### unwrap_or_default : 获取值,如果为`None`则返回传入的值的default调用 */ unwrap_or_default(value: Default): T | R; /** ### map : 如果为`Some`调用callback结果替换Some值 : 如果返回值为null / underfind 则返回None */ map(callback: Fn): Option; /** ### and_then : 将`Options`数据进行转换 */ and_then(callback: Fn, R>): R; /** ### each : 遍历函数,如果结果为some执行`some`回调;如果结果为none执行`none`回调 */ each(some: Fn, none: FnReturn): Option; /** ### some_do : 如果为`Some`就执行 */ some_do(fn: Fn): void; /** ### none_do : 如果为`None`就执行 */ none_do(fn: FnReturn): void; /** ### match : `Some`|`None` 的回调执行 */ match(some: Fn, none: FnReturn): void; /** ### into : 实现{@link Into}接口 转换规则 : + `Ok(O)` -> `Some` | `Left` + `Err(E)` -> `None` | `Right` */ into(flag: R): R extends 'result' ? Result : R extends 'either' ? Either : never; /** ### as : 实现{@link As}接口 转换规则 : + `Some(O)` -> `true` | `Mainstream` + `None` -> `false` | `Reflux` */ as(flag: R): R extends 'boolean' ? boolean : R extends 'shunt' ? Shunt : never; } /** ## AsyncOption : 对Option类型的异步封装 @category TypeClass */ export type AsyncOption = Promise>; export {}; //# sourceMappingURL=interface.d.ts.map