Files
DefinitelyTyped/types/p-limit/p-limit-tests.ts
Neil Gentleman 038d712743 [p-limit] fix generics (#23066)
generated limit functions don't care about types, but preserve the return
type of the function that they are passed.
2018-01-24 12:00:46 -08:00

14 lines
297 B
TypeScript

import pLimit = require('p-limit');
const limit = pLimit(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];
});