flex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alex Harui <aha...@adobe.com>
Subject Re: [FlexJS] typeof X === 'undefined'
Date Mon, 20 Mar 2017 15:10:55 GMT


On 3/20/17, 3:52 AM, "piotrz" <piotrzarzycki21@gmail.com> wrote:

>I think both cases can be handled by
>
>if (_responseHeaders) {}
>
>Need to be confirmed.

IMO, that depends on whether null is a potential value with a separate
code path.  Also, in this case _responseHeaders is an Array, but if it
were an int or string, the 0 and "" would probably not go down the code
path you expected.

I think that null is not a possible value in this particular case, so you
are right that we could code it up that way.  Maybe that's sufficient for
now and we'll see if other scenarios arise and discuss more when that
happens.

It could be that when null and undefined do have separate code paths that
the type of the variable should be '*', or maybe if the need is rare
enough, that the developer should suppress the warning on a per-use basis
instead of changing compiler logic.

Of course, I could be wrong...
-Alex

Mime
View raw message