Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

chore: remove Promise.allSettled shim #4003

Merged
merged 6 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/packages/core/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ import {

import allSettled from "promise.allsettled";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The promise.allsettled package itself should be removed.


// This `shim()` is necessary for `Promise.allSettled` to be shimmed
// in `node@10`. We cannot use `allSettled([...])` directly due to
// https://github.com/es-shims/Promise.allSettled/issues/5 without
// upgrading Typescript. TODO: if Typescript is upgraded to 4.2.3+
// then this line could be removed and `Promise.allSettled` below
// could replaced with `allSettled`.
allSettled.shim();

import AggregateError from "aggregate-error";
import type {
TemplatedApp,
Expand Down Expand Up @@ -225,7 +217,7 @@ export class Server<

this.#status = ServerStatus.opening;

const promise = Promise.allSettled([
const promise = allSettled([
this.#initializer,
new Promise(
(resolve: (listenSocket: false | us_listen_socket) => void) => {
Expand Down Expand Up @@ -263,10 +255,10 @@ export class Server<
const errors: Error[] = [];

if (promiseResults[0].status === "rejected") {
errors.push(promiseResults[0].reason);
errors.push(promiseResults[0].reason as Error);
}
if (promiseResults[1].status === "rejected") {
errors.push(promiseResults[1].reason);
errors.push(promiseResults[1].reason as Error);
}

if (errors.length === 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/packages/ganache/npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.