export interface Succeeded < T > { readonly succeeded : true ; readonly result : T ; } export interface Failed { readonly succeeded : false ; readonly error : string [ ] ; } export type Errorable < T > = Succeeded < T > | Failed ; export function succeeded < T > ( e ) { return e . succeeded ; } export function failed < T > ( e ) { return ! e . succeeded ; } export namespace Errorable { export function succeeded < T > ( e ) { return e . succeeded ; } export function failed < T > ( e ) { return ! e . succeeded ; } }