Files
DefinitelyTyped/types/p-try/p-try-tests.ts
Dimitri Benin 89e1856678 [p-try] introduce typings (#18586)
Add an optional extended description…
2017-08-04 17:17:51 -07:00

17 lines
285 B
TypeScript

import pTry = require('p-try');
function throws(): never {
throw new Error('foo');
}
let str: string;
pTry(() => 'foo').then(value => {
str = value;
});
pTry(() => Promise.resolve('foo')).then(value => {
str = value;
});
pTry(throws).then(value => {
str = value;
});