Clean up code to compile correctly with TypeScript 0.9.0