/**
 * Result is a return type for functions which might return a value
 * or might fail and return a string which describes the error.
 * Intended for functions which are called from a GUI and should provide an error message if one occurs.
 *
 * The result is represented by the  Failure and  Success types.
 *
 *  typeParam export type Result < T > = Failure | Success < T > ; /**
 * Function has failed and has returned a string describing the error.
 * Should be created by calling  error .
  export type Failure = { failed : true ; errorMessage : string ; } ; /**
 * Function has succeeded and has returned its result.
 * Should be created by calling  success or  emptySuccess .
  export type Success < T > = { failed : false ; result : T ; } ; param errorMessage export function error ( errorMessage ) { return { failed : true , errorMessage : errorMessage } ; } param result export function success < T > ( result ) { return { failed : false , result : result } ; } /**
 * Indicates that a void function has executed successfully but wants to return void/nothing.
 */ export function emptySuccess ( ) { return success ( undefined ) ; }