r3bl-ts-utils
Version:
The `r3bl-ts-utils` package is a set of useful TypeScript functions and classes that can be used in Node.js and browser environments. They are inspired by Kotlin stdlib, and Rust to write code as expressions rather than statements, colorized text, powerfu
31 lines (30 loc) • 1.19 kB
TypeScript
import { TextColor } from "../tui-colors/style-builder";
import { Optional } from "./core";
import { SimpleReceiverFn, TruthyReceiverFn } from "./expression-lang-utils";
export declare abstract class Option<T> {
readonly _isSome: boolean;
constructor(value: T | undefined | null);
isSome(): this is Some<T>;
isNone(): this is None<T>;
abstract toString(): string;
static none: <T_1>() => None<T_1>;
static some: <T_1 extends {}>(arg: T_1) => Some<T_1>;
static create: <T_1>(arg: Optional<T_1>) => Option<T_1>;
}
export declare class None<T> extends Option<T> {
constructor();
toString(): string;
}
export declare class Some<T extends {}> extends Option<T> {
readonly _value: T;
constructor(value: T);
toString(): string;
get value(): T;
}
export declare const _callIfSome: <T>(context: Option<T>, receiver: TruthyReceiverFn<T>) => void;
export declare const _callIfNone: <T>(context: Option<T>, receiver: SimpleReceiverFn) => void;
export declare const DebugStyle: Readonly<{
msgStyle: TextColor & import("..").FormatFn;
argStyle: TextColor & import("..").FormatFn;
}>;
export declare function debug(msg: string, obj: any): any;