Method chaining in TypeScript