Use an `iife` Helper for Inline Control Flow in TypeScript

Create a small `iife` helper to use `if`, `try`/`catch`, and async code where JavaScript only accepts expressions.