decline-ts
Version:
Composable command-line parser for TypeScript - a (partial) porting of Scala decline using fp-ts
15 lines (14 loc) • 1.05 kB
TypeScript
import { either, option, readonlyNonEmptyArray } from 'fp-ts';
import { Either } from 'fp-ts/Either';
import { Lazy } from 'fp-ts/function';
import { Option } from 'fp-ts/Option';
import { ReadonlyNonEmptyArray } from 'fp-ts/ReadonlyNonEmptyArray';
export declare type ValidatedNea<E, A> = Either<ReadonlyNonEmptyArray<E>, A>;
export declare namespace ValidatedNea {
const right: <E = never, A = never>(a: A) => either.Either<readonlyNonEmptyArray.ReadonlyNonEmptyArray<E>, A>;
const left: <E = never, A = never>(e: E) => either.Either<readonlyNonEmptyArray.ReadonlyNonEmptyArray<E>, A>;
const fromEither: <E, A>(e: Either<E, A>) => ValidatedNea<E, A>;
const fromOption: <E, A>(onNone: Lazy<E>) => (ma: option.Option<A>) => either.Either<readonlyNonEmptyArray.ReadonlyNonEmptyArray<E>, A>;
const fromEmptyE: <E, A>(e: E) => (e_: either.Either<readonly E[], A>) => either.Either<readonlyNonEmptyArray.ReadonlyNonEmptyArray<E>, A>;
const fromEmptyErrors: <A>(e: Either<ReadonlyArray<string>, A>) => ValidatedNea<string, A>;
}