From 6bc3587c37b735366e7b6be99d33383e2af99bc3 Mon Sep 17 00:00:00 2001 From: Benjamin Pannell Date: Tue, 12 Apr 2016 15:49:47 +0200 Subject: [PATCH] refactor: Switch to promises-a-plus for cache promise definition --- dist/lib/Cache.d.ts | 2 +- lib/Cache.ts | 2 +- typings.json | 3 ++- typings/main.d.ts | 1 + .../main/ambient/promises-a-plus/index.d.ts | 20 +++++++++++++++++++ 5 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 typings/main/ambient/promises-a-plus/index.d.ts diff --git a/dist/lib/Cache.d.ts b/dist/lib/Cache.d.ts index be92a32..e1c45f5 100644 --- a/dist/lib/Cache.d.ts +++ b/dist/lib/Cache.d.ts @@ -1,5 +1,5 @@ export interface Cache { set(key: string, value: T): void; - get(key: string): Thenable; + get(key: string): PromisesAPlus.Thenable; clear(key: string): void; } diff --git a/lib/Cache.ts b/lib/Cache.ts index 02a7a83..2cba3ff 100644 --- a/lib/Cache.ts +++ b/lib/Cache.ts @@ -1,5 +1,5 @@ export interface Cache { set(key: string, value: T): void; - get(key: string): Thenable; + get(key: string): PromisesAPlus.Thenable; clear(key: string): void } \ No newline at end of file diff --git a/typings.json b/typings.json index b4cc146..f04a6e7 100644 --- a/typings.json +++ b/typings.json @@ -10,7 +10,8 @@ }, "ambientDependencies": { "es6-promise": "registry:dt/es6-promise#0.0.0+20160317120654", - "node": "registry:dt/node#4.0.0+20160330064709" + "node": "registry:dt/node#4.0.0+20160330064709", + "promises-a-plus": "registry:dt/promises-a-plus#0.0.0+20160317120654" }, "devDependencies": { "chai": "registry:npm/chai#3.5.0+20160402210230", diff --git a/typings/main.d.ts b/typings/main.d.ts index 5a8a512..a93ea0b 100644 --- a/typings/main.d.ts +++ b/typings/main.d.ts @@ -1,6 +1,7 @@ /// /// /// +/// /// /// /// diff --git a/typings/main/ambient/promises-a-plus/index.d.ts b/typings/main/ambient/promises-a-plus/index.d.ts new file mode 100644 index 0000000..e6f3b99 --- /dev/null +++ b/typings/main/ambient/promises-a-plus/index.d.ts @@ -0,0 +1,20 @@ +// Generated by typings +// Source: https://raw.githubusercontent.com/DefinitelyTyped/DefinitelyTyped/7de6c3dd94feaeb21f20054b9f30d5dabc5efabd/promises-a-plus/promises-a-plus.d.ts +// Type definitions for promises-a-plus +// Project: http://promisesaplus.com/ +// Definitions by: Igor Oleinikov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare namespace PromisesAPlus { + interface PromiseCtor { + (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable; + } + + interface PromiseImpl { + new (resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable; + } + + interface Thenable { + then(onFulfill?: (value: T) => Thenable|R, onReject?: (error: any) => Thenable|R): Thenable; + } +} \ No newline at end of file