Skip to content

Commit

Permalink
refactor: Switch to promises-a-plus for cache promise definition
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Apr 12, 2016
1 parent 5651467 commit 6bc3587
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/lib/Cache.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Cache {
set<T>(key: string, value: T): void;
get<T>(key: string): Thenable<T>;
get<T>(key: string): PromisesAPlus.Thenable<T>;
clear(key: string): void;
}
2 changes: 1 addition & 1 deletion lib/Cache.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export interface Cache {
set<T>(key: string, value: T): void;
get<T>(key: string): Thenable<T>;
get<T>(key: string): PromisesAPlus.Thenable<T>;
clear(key: string): void
}
3 changes: 2 additions & 1 deletion typings.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions typings/main.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/// <reference path="main/ambient/es6-promise/index.d.ts" />
/// <reference path="main/ambient/mocha/index.d.ts" />
/// <reference path="main/ambient/node/index.d.ts" />
/// <reference path="main/ambient/promises-a-plus/index.d.ts" />
/// <reference path="main/definitions/bluebird/index.d.ts" />
/// <reference path="main/definitions/chai-as-promised/index.d.ts" />
/// <reference path="main/definitions/chai/index.d.ts" />
Expand Down
20 changes: 20 additions & 0 deletions typings/main/ambient/promises-a-plus/index.d.ts
Original file line number Diff line number Diff line change
@@ -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 <https://github.com/Igorbek>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

declare namespace PromisesAPlus {
interface PromiseCtor {
<T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable<T>;
}

interface PromiseImpl {
new <T>(resolver: (resolvePromise: (value: T) => void, rejectPromise: (reason: any) => void) => void): Thenable<T>;
}

interface Thenable<T> {
then<R>(onFulfill?: (value: T) => Thenable<R>|R, onReject?: (error: any) => Thenable<R>|R): Thenable<R>;
}
}

0 comments on commit 6bc3587

Please sign in to comment.