Often we have to check variables for empty values.
If variables has undefined or null types we check for that types.
But if we want to refactor our code, and replace nullable variables to always with value, we init its with empty values like false, 0, -1, ""
But checks that variables for null or undefined in other parts of program are still there, and make a lot of bugs
let a: string | undefined;
if (a !== undefined) {
foo(a);
}
// and if we refactor
let a = '';
// In this check we potentially has a bug, cause undefined is not possible here,
if (a !== undefined) {
foo(a);
}