A bug has surfaced due to the way variables are captured in scope in JavaScript. Rather than wrap the call in additional code that adds complexity, a simple change is to specify the variable with "let". The TypeScript compiler then knows to manage scope for older version of JavaScript, and passes through to modern implementations.
Learn more about "let" declarations: https://jlik.me/ffm