Skip to content

Instantly share code, notes, and snippets.

Created September 21, 2015 14:56
What would you like to do?
// 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