Skip to content

Instantly share code, notes, and snippets.

@bryanforbes
Created September 21, 2015 14:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryanforbes/f8a837ed58065e992977 to your computer and use it in GitHub Desktop.
Save bryanforbes/f8a837ed58065e992977 to your computer and use it in GitHub Desktop.
// 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>;
}
}
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