Live with grace. Write superb software.


After a bit of fiddling around I managed to convince the core-promise implementation to actually implement the Promise interface from the ES6 typescript definitions itself:

 * Represents the completion of an asynchronous operation
interface Promise<T> {
    * Attaches callbacks for the resolution and/or rejection of the Promise.
    * @param onfulfilled The callback to execute when the Promise is resolved.
    * @param onrejected The callback to execute when the Promise is rejected.
    * @returns A Promise for the completion of which ever callback is executed.
    then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>)" Promise<TResult>;
    then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>; 
     * Attaches a callback for only the rejection of the Promise.
     * @param onrejected The callback to execute when the Promise is rejected.
     * @returns A Promise for the completion of the callback.
    catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
    catch(onrejected?: (reason: any) => void): Promise<T>;
    [Symbol.toStringTag]: string;

Thus not only you have now all the test guarantees, you also get the API guarantees. Neat!

So now we have:

export class CorePromise<T> implements Promise<T>, Symbol {
export var DefaultPromise = (typeof Promise == "undefined") ? 
  CorePromise : Promise;


Further, I propagated the changes in turn to the core-lang project as well, so now the collections also work with pure Promise objects, and no more CorePromise API dependencies are in the API either (see d.ts here for core-lang). Sweet-sweet-sweet.


And while I'm at it, if you're using dts-generator from grunt, and experiencing this issue, where all the TypeScript classes from all your dependencies and TypeScript itself get generated into your output .d.ts file, you might want to use ciplogic-dts-generator. The difference in your grunt file can quite significant.


The one to rule them all. The browsers that is.


SharpKnight is an Android chess game.


MagicGroup is an eclipse plugin.