Based on http://www.piotrwalat.net/using-typescript-with-angularjs-and-web-api/