Options
All
  • Public
  • Public/Protected
  • All
Menu

File Either

The Either type represents an alternative between two value types. A "left" value which is also conceptually tied to a failure, or a "right" value which is conceptually tied to success.

The code is organized through the class Left, the class Right, and the type alias Either (Left or Right).

Finally, "static" functions on Option are arranged in the class EitherStatic and are accessed through the global constant Either.

Examples:

Either.right<number,number>(5);
Either.left<number,number>(2);
Either.right<number,number>(5).map(x => x*2);

Left has the extra Left.getLeft method that Right doesn't have. Right has the extra Right.get method that Left doesn't have.

Index

Classes

Type aliases

Variables

Type aliases

Either

Either: Left<L, R> | Right<L, R>

Either represents an alternative between two value types. A "left" value which is also conceptually tied to a failure, or a "right" value which is conceptually tied to success. "static methods" available through EitherStatic

Variables

Either

Either: EitherStatic = new EitherStatic()

The Either constant allows to call the either "static" methods

Generated using TypeDoc