mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
14 lines
385 B
TypeScript
14 lines
385 B
TypeScript
import pSettle = require('p-settle');
|
|
|
|
async function f() {
|
|
const promises: Array<Promise<string>> = [];
|
|
for (let index = 0; index < 10; ++index) {
|
|
if (index % 3 === 0) {
|
|
promises.push(Promise.reject(new Error('i reject you')));
|
|
} else {
|
|
promises.push(Promise.resolve('🦄'));
|
|
}
|
|
}
|
|
const results = await pSettle(promises);
|
|
}
|