Refactoring working JavaScript code to satisfy limitations in TypeScript.

Everything is fine.

I am being productive.

This is productivity.