Start of TypeScript solution