I'm trying to set the variable value when it's undefined however, I'm getting an error while trying to use vanilla javascript approach.
Block-scoped variable 'x' used before its declaration.
What is the best approach when using typescript for setting undefined variable?
let x = (typeof x === 'undefined') ? def_val : x;