I am using this code to check undefined variable but it\'s not working.
NOT STRICTLY RELATED TO TYPESCRIPT
Just to add to all the above answers, we can also use the shorthand syntax
var result = uemail || '';
This will give you the email if uemail variable has some value and it will simply return an empty string if uemail variable is undefined.
This gives a nice syntax for handling undefined variables and also provide a way to use a default value in case the variable is undefined.