Definitelytyped: [@types/node] Missing Promise.allSettled definition

Created on 13 Nov 2019  路  2Comments  路  Source: DefinitelyTyped/DefinitelyTyped

  • [x] I tried using the @types/node package and had problems.

This is mentioned in by @SimonSchick in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/38401

I'm concerned causing incompatibilities due to name/signature conflicts of types.

Currently, @types/node at 12.12.7 does not have definitions for Promise.allSettled

Most helpful comment

Gotta wait for new libs, alternatively you can just write your own version by extending the definition of Promise until we get an official one :)

All 2 comments

Gotta wait for new libs, alternatively you can just write your own version by extending the definition of Promise until we get an official one :)

How long must we wait?

The promise extension (workaround) would be something like the following from SO?

declare interface PromiseConstructor {
    allSettled(promises: Array<Promise<any>>): Promise<Array<{status: 'fulfilled' | 'rejected', value?: any, reason?: any}>>;
}

Also see: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/promise.allsettled

Was this page helpful?
0 / 5 - 0 ratings