跳至主要內容

Promise.allSettled

小于 1 分钟featurees-proposalmissing-example

Promise.allSettledopen in new window

类型

interface PromiseConstructor {
  allSettled<T>(
    iterable: Iterable<Promise<T>>
  ): Promise<PromiseSettledResult<T>>;
}

type PromiseSettledFulfilledResult<T> = {
  status: "fulfilled";
  value: T;
};
type PromiseSettledRejectedResult = {
  status: "rejected";
  reason: any;
};

type PromiseSettledResult<T> =
  | PromiseSettledFulfilledResult<T>
  | PromiseSettledRejectedResult;

入口点

core-js/proposals/promise-all-settled