ts-results
Advanced tools
Comparing version
{ | ||
"name": "ts-results", | ||
"version": "3.2.0", | ||
"version": "3.2.1", | ||
"description": "A typescript implementation of Rust's Result and Option objects.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -34,3 +34,6 @@ interface BaseResult<T, E> extends Iterable<T extends Iterable<infer U> ? U : never> { | ||
*/ | ||
andThen<T2>(mapper: (val: T) => Ok<T2>): Result<T2, E>; | ||
andThen<E2>(mapper: (val: T) => Err<E2>): Result<T, E | E2>; | ||
andThen<T2, E2>(mapper: (val: T) => Result<T2, E2>): Result<T2, E | E2>; | ||
andThen<T2, E2>(mapper: (val: T) => Result<T2, E2>): Result<T2, E | E2>; | ||
/** | ||
@@ -71,7 +74,7 @@ * Maps a `Result<T, E>` to `Result<U, E>` by applying a function to a contained `Ok` value, | ||
map(_mapper: unknown): Err<E>; | ||
andThen<T2, E2>(op: unknown): Err<E>; | ||
andThen(op: unknown): Err<E>; | ||
mapErr<E2>(mapper: (err: E) => E2): Err<E2>; | ||
toString(): string; | ||
} | ||
export declare const Err: typeof ErrImpl & (<E>(err: E) => ErrImpl<E>); | ||
export declare const Err: typeof ErrImpl & (<E>(err: E) => Err<E>); | ||
export declare type Err<E> = ErrImpl<E>; | ||
@@ -100,2 +103,4 @@ /** | ||
map<T2>(mapper: (val: T) => T2): Ok<T2>; | ||
andThen<T2>(mapper: (val: T) => Ok<T2>): Ok<T2>; | ||
andThen<E2>(mapper: (val: T) => Err<E2>): Result<T, E2>; | ||
andThen<T2, E2>(mapper: (val: T) => Result<T2, E2>): Result<T2, E2>; | ||
@@ -115,3 +120,3 @@ mapErr(_mapper: unknown): Ok<T>; | ||
} | ||
export declare const Ok: typeof OkImpl & (<T>(val: T) => OkImpl<T>); | ||
export declare const Ok: typeof OkImpl & (<T>(val: T) => Ok<T>); | ||
export declare type Ok<T> = OkImpl<T>; | ||
@@ -118,0 +123,0 @@ export declare type Result<T, E> = Ok<T> | Err<E>; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92754
0.98%1317
0.38%