0

So, I have several checks like this in my code:

if (callerParam != undefined || callerParam != null)

I now upgraded to Typescript 2.0 and Visual Studio is telling 'Cannot resolve symbol 'undefined''.

But the compare to null is just fine.

So I guess I can go change all my compares to be like this:

if (typeof callerParam !== 'undefined' || callerParam != null)

and the intellisense is OK with that.

But it seems inconsistent.

Is there a way to get my consistant, happy, world back?

And, why is undefined not valid anymore? And yet it is valid javascript right?

Vaccano
  • 78,325
  • 149
  • 468
  • 850

0 Answers0