Rewrote rope in TypeScript