I have code that loops, and I want to initialize the variable one within the code. To do this, I check if the variable exists, and if not, initialize it.
In JavaScript, I would normally just do the following
if (typeof variableExample === 'undefined') {
// run this code
}
But TypeScript doesn’t like this. It tells me that it can’t perform this because it cannot find the variable:
Any ideas for getting around this?