Files
DefinitelyTyped/types/p-limit/p-limit-tests.ts
2017-08-08 13:53:36 -07:00

14 lines
317 B
TypeScript

import pLimit = require('p-limit');
const limit = pLimit<string | undefined>(1);
const input = [
limit(() => Promise.resolve('foo')),
limit(() => Promise.resolve('bar')),
limit(() => Promise.resolve(undefined)),
];
Promise.all(input).then(result => {
const str: string | undefined = result[0];
});