Promises/A+ implementation written in TypeScript