mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-23 12:56:46 +08:00
27 lines
549 B
TypeScript
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(() => {});
|