UNPKG

maybetyped

Version:

Well-typed functional Maybe monad

17 lines (16 loc) 693 B
import { Nullable } from 'simplytyped'; import Maybe, { MatchType } from "./maybe"; export default class Some<T> extends Maybe<T> { static some<T>(thing: T): Some<T>; expect(): NonNullable<T>; caseOf<R>(funcs: MatchType<T, R>): Maybe<R>; map<U>(f: (v: T) => Nullable<U>): Maybe<U>; tap(f: (v: T) => void): Maybe<T>; flatMap<U>(f: (v: T) => Maybe<U>): Maybe<U>; orElse<U>(def: U | (() => U)): T | U; or<U>(other: Maybe<U> | (() => Maybe<U>)): Maybe<T | U>; eq(other: Maybe<T>): boolean; join<U, R>(f: (x: T, y: U) => Nullable<R>, other: Maybe<U>): Maybe<R>; asNullable(): T | null; } export declare const some: <T>(x: T) => Maybe<T>;