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
TypeScript Version: 2.2.0-dev.20161114
The emit for __rest uses !e.indexOf(p) to check as to whether a property name should be excluded. This test is incorrect as Array.prototype.indexOf return -1 if an element is not found, or a zero-bounded index if an element is found, for example:
conste=["a","b"];!e.indexOf("a")===!(0)===true// fail, we want 'false' here`!e.indexOf("b")===!(1)===false// ok, we want 'false' here`!e.indexOf("c")===!(-1)===false// fail, we want 'true' here`
A concise and correct test should instead be !~e.indexOf(p), as unary ~ will give the twos-complement of e.indexOf(p):
conste=["a","b"];!~e.indexOf("a")===!~(0)===!(-1)===false// ok, we want 'false' here!~e.indexOf("b")===!~(1)===!(-2)===false// ok, we want 'false' here!~e.indexOf("c")===!~(-1)===!(0)===true// ok, we want 'true' here
TypeScript Version: 2.2.0-dev.20161114
The emit for
__rest
uses!e.indexOf(p)
to check as to whether a property name should be excluded. This test is incorrect asArray.prototype.indexOf
return-1
if an element is not found, or a zero-bounded index if an element is found, for example:A concise and correct test should instead be
!~e.indexOf(p)
, as unary~
will give the twos-complement ofe.indexOf(p)
:Expected emit:
Actual emit:
The text was updated successfully, but these errors were encountered: