Created
September 21, 2015 14:56
-
-
Save bryanforbes/f8a837ed58065e992977 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ambient module definition | |
declare module 'dojo-core/Promise' { | |
// interface definition | |
export interface Executor<T> { | |
(resolve: (value?: T | Thenable<T>) => void, reject: (reason?: any) => void): void; | |
} | |
// function definition | |
export function isThenable(value: any): boolean; | |
// class definition | |
export class PromiseShim<T> implements Thenable<T> { | |
} | |
// interface definition | |
export interface Thenable<T> { | |
then<U>(onFulfilled?: (value?: T) => U | Thenable<U>, onRejected?: (error?: any) => U | Thenable<U>): Thenable<U>; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Promise, Thenable } from 'dojo-core/Promise'; | |
// The compiler knows about 'dojo-core/Promise' from the .d.ts file and we | |
// can use Promise as if we were compiling dojo-core/Promise from a .ts file. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment