Class PromiseState

public

PromiseState provides a reactive wrapper for a promise which allows you write declarative code around a promise's control flow. It is useful in both Template and JavaScript contexts, allowing you to quickly derive behaviors and data from pending, error and success states.

interface PromiseState<T = unknown, E = unknown> {
  isPending: boolean;
  isSuccess: boolean;
  isError: boolean;
  result: T | null;
  error: E | null;
}

To get the state of a promise, use getPromiseState.