exupery-core-internals
Version:
19 lines (18 loc) • 1.3 kB
TypeScript
export interface Unguaranteed_Transformation_Result<T, E> {
/**
* @param set what to do when the value was set, returns the new type
* @param not_set what to do when the value was not set, returns the new type
*/
process(success: ($: T) => void, exception: ($: E) => void): void;
map<NT, NE>(handle_value: ($: T) => NT, handle_exception: ($: E) => NE): Unguaranteed_Transformation_Result<NT, NE>;
map_result<NT>(handle_value: ($: T) => NT): Unguaranteed_Transformation_Result<NT, E>;
transform<NT>(handle_value: ($: T) => NT, handle_exception: ($: E) => NT): NT;
}
export type Guaranteed_Transformation_With_Parameters<In, Parameters, Out> = ($: In, $p: Parameters) => Out;
export type Guaranteed_Transformation_Without_Parameters<In, Out> = ($: In) => Out;
export type Unguaranteed_Transformation_With_Parameters<In, Parameters, Out, Error> = ($: In, $p: Parameters) => Unguaranteed_Transformation_Result<Out, Error>;
export type Unguaranteed_Transformation_Without_Parameters<In, Out, Error> = ($: In) => Unguaranteed_Transformation_Result<Out, Error>;
export declare namespace transformation {
const failed: <T, E>(exception: E) => Unguaranteed_Transformation_Result<T, E>;
const successful: <T, E>(value: T) => Unguaranteed_Transformation_Result<T, E>;
}