From 755a176d13d20ce10983d471a9926351d58cb606 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 14 Mar 2020 01:02:32 +0000 Subject: [PATCH] Fix building? --- package.json | 1 + types/global.d.ts | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 types/global.d.ts diff --git a/package.json b/package.json index c503294..57ed666 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "@types/ioredis": "^4.0.18", "@types/moment-precise-range-plugin": "^0.2.0", "@types/mongoose": "^5.5.20", + "@types/node": "^13.9.1", "@types/nodemailer": "^6.2.1", "@types/signale": "^1.2.1", "@types/uuid": "^3.4.5", diff --git a/types/global.d.ts b/types/global.d.ts new file mode 100644 index 0000000..04a9dd5 --- /dev/null +++ b/types/global.d.ts @@ -0,0 +1,31 @@ + +interface PromiseFulfilledResult { + status: 'fulfilled'; + value: T; +} + +interface PromiseRejectedResult { + status: 'rejected'; + reason: any; +} + +type PromiseSettledResult = PromiseFulfilledResult | PromiseRejectedResult; + +interface PromiseConstructor { + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled(values: T): + Promise<{ -readonly [P in keyof T]: PromiseSettledResult ? U : T[P]> }>; + + /** + * Creates a Promise that is resolved with an array of results when all + * of the provided Promises resolve or reject. + * @param values An array of Promises. + * @returns A new Promise. + */ + allSettled(values: Iterable): Promise ? U : T>[]>; +}