Having experience in the ML world, I'm used to creating variables with limited scope like this:
let myVar =
let result1 = doSomething()
let result2 = doSomethingElse()
result1 + result2
In TypeScript, it seems you can achieve similar scoping using anonymous functions:
const myVar =
function() {
const result1 = doSomething();
const result2 = doSomethingElse();
return result1 + result2;
}();
The issue is that this method adds extra indentation and may confuse the purpose of the code. Is there a more streamlined approach to handle this situation?