mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-08 08:04:19 +08:00
17 lines
285 B
TypeScript
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;
|
|
});
|