ReadResult<T, E>: {
    data: undefined;
    error: undefined;
    loading: true;
} | {
    data: T;
    error: undefined;
    loading: false;
} | {
    data: undefined;
    error: E;
    loading: false;
}

A discriminated union of the possible results of a read operation.

You can rely on the loading value to determine if the data or error can be evaluated.

If error is undefined, then data value will be available.

Type Parameters

Type declaration

  • data: undefined
  • error: undefined
  • loading: true

Type declaration

  • data: T
  • error: undefined
  • loading: false

Type declaration

  • data: undefined
  • error: E
  • loading: false