F95API/scripts/classes/result.d.ts

18 lines
633 B
TypeScript
Raw Normal View History

2021-03-05 11:27:36 +00:00
export declare type Result<L, A> = Failure<L, A> | Success<L, A>;
export declare class Failure<L, A> {
2021-03-05 12:05:49 +00:00
readonly value: L;
constructor(value: L);
isFailure(): this is Failure<L, A>;
isSuccess(): this is Success<L, A>;
applyOnSuccess<B>(_: (a: A) => B): Result<L, B>;
2021-03-05 11:27:36 +00:00
}
export declare class Success<L, A> {
2021-03-05 12:05:49 +00:00
readonly value: A;
constructor(value: A);
isFailure(): this is Failure<L, A>;
isSuccess(): this is Success<L, A>;
applyOnSuccess<B>(func: (a: A) => B): Result<L, B>;
2021-03-05 11:27:36 +00:00
}
export declare const failure: <L, A>(l: L) => Result<L, A>;
export declare const success: <L, A>(a: A) => Result<L, A>;