You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The for..in statement in ECMAScript does not throw if the expression is undefined or null, but rather the loop body is not evaluated. As such, the correct behavior under --strictNullChecks should be:
The for..in statement (1) should be legal, even if x is undefined or null.
Inside the for..in statement, the x (2) should no longer be considered undefined or null.
Actual behavior:
The for..in statement (1) reports the error: Object is possibly 'null' or 'undefined'.
Inside the for..in statement, the x (2) reports the error: Object is possibly 'null' or 'undefined'.
The text was updated successfully, but these errors were encountered:
rbuckton
changed the title
'for..in' for 'undefined' expression should not be an error in '--strictNullChecks'
'for..in' for undefined expression should not be an error in --strictNullChecks
Oct 25, 2017
rbuckton
changed the title
'for..in' for undefined expression should not be an error in --strictNullChecks
'for..in' for null/undefined expression should not be an error in --strictNullChecks
Oct 25, 2017
Expected behavior:
The
for..in
statement in ECMAScript does not throw if the expression isundefined
ornull
, but rather the loop body is not evaluated. As such, the correct behavior under--strictNullChecks
should be:for..in
statement (1) should be legal, even ifx
isundefined
ornull
.for..in
statement, thex
(2) should no longer be consideredundefined
ornull
.Actual behavior:
for..in
statement (1) reports the error:Object is possibly 'null' or 'undefined'.
for..in
statement, thex
(2) reports the error:Object is possibly 'null' or 'undefined'.
The text was updated successfully, but these errors were encountered: