Converted from CoffeeScript to TypeScript