Port of Bacon to TypeScript