mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-12 19:59:02 +08:00
* Add shim function to typings Add shim function to typings for promise.prototype.finally so that it can be used in a TypeScript project. * Added shim test * Update code style. * Change return type to original promise. The finally block should return the type of the original promise, not whatever is passed in to the finally block.
13 lines
412 B
TypeScript
13 lines
412 B
TypeScript
// Type definitions for promise.prototype.finally v2.0.1
|
|
// Project: https://github.com/matthew-andrews/Promise.prototype.finally
|
|
// Definitions by: Slava Shpitalny <https://github.com/slavik57>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
declare global {
|
|
interface Promise<T> {
|
|
finally<U>(onFinally?: () => U | Promise<U>): Promise<T>;
|
|
}
|
|
}
|
|
|
|
export function shim(): void;
|