Updated for TypeScript 1.0 - Read about problems here: http://stackoverflow.com/questions/23003188/working-around-loss-of-support-for-type-constraint-being-self