Accept PromiseLike object

This commit is contained in:
kimu_shu
2017-07-01 12:23:19 +09:00
parent c126a9ec44
commit df59d9f5b9
2 changed files with 2 additions and 1 deletions

View File

@@ -5,7 +5,7 @@
declare global {
interface Promise<T> {
finally<U>(onFinally?: () => U | Promise<U>): Promise<T>;
finally<U>(onFinally?: () => U | PromiseLike<U>): Promise<T>;
}
}

View File

@@ -7,6 +7,7 @@ var promise = new Promise<Boolean>((resolve, reject) => {
});
promise.finally(() => {});
promise.finally(() => <PromiseLike<void>>Promise.resolve());
promise.then(() => {}, () => {}).finally(() => {});
promise.catch(() => {}).finally(() => {});