Type alias APIResult<TResult, TError>

APIResult<TResult, TError>: {
    error?: never;
    success: true;
    value: TResult;
} | {
    code?: number;
    error: TError;
    success: false;
    value?: never;
}

When we call the Zupass server, we encapsulate the result in a APIResult. HTTP requests to the Zupass server never throw exceptions or reject promises - all possible results are encoded in this type.

Type Parameters

  • TResult = unknown
  • TError = string

Type declaration

  • Optional error?: never
  • success: true
  • value: TResult

Type declaration

  • Optional code?: number
  • error: TError
  • success: false
  • Optional value?: never

Generated using TypeDoc