Files
DefinitelyTyped/types/p-tap/p-tap-tests.ts
2017-08-20 15:37:53 -07:00

27 lines
549 B
TypeScript

import pTap = require('p-tap');
Promise.resolve('unicorn')
.then(pTap<string>(val => {
const str: string = val;
return 1;
}))
.then(val => {
const str: string = val;
});
Promise.resolve('unicorn')
.then(pTap<string>(val => {
const str: string = val;
return Promise.resolve(1);
}))
.then(val => {
const str: string = val;
});
Promise.reject(new Error())
.catch(pTap.catch(val => {
const num: number = val;
}))
.then(() => 1)
.catch(() => {});