Convert JS to TypeScript