mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-06 06:19:58 +08:00
Accept PromiseLike object
This commit is contained in:
2
types/promise.prototype.finally/index.d.ts
vendored
2
types/promise.prototype.finally/index.d.ts
vendored
@@ -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>;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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(() => {});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user