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
It consistently fails when comparing a number and a string.
Actual behavior
The current behavior is absolutely inconsistent, mainly between the behavior of double and triple equals comparison, but it is also inconsistent when using triple equals against a number literal. See the following cases:
When doing someNumber == someString it fails with the message Cannot compare string [1] to number [2].
When doing someNumber === someString it doesn't fail at all.
When doing if(someString === 3) it fails with the message number literal 3 [1] is incompatible with string [2].
When doing console.log(someString === 3) it doesn't fail at all.
When doing if(someString === someNumber) and console.log(someString === someNumber) it doesn't fail at all.
augusto-altman
changed the title
Inconsistent behaviour between double and triple equal
Inconsistent behaviour between double and triple equals
Feb 4, 2020
Flow version: v0.117.1
Expected behavior
It consistently fails when comparing a number and a string.
Actual behavior
The current behavior is absolutely inconsistent, mainly between the behavior of double and triple equals comparison, but it is also inconsistent when using triple equals against a number literal. See the following cases:
When doing
someNumber == someString
it fails with the messageCannot compare string [1] to number [2].
When doing
someNumber === someString
it doesn't fail at all.When doing
if(someString === 3)
it fails with the messagenumber literal
3[1] is incompatible with string [2].
When doing
console.log(someString === 3)
it doesn't fail at all.When doing
if(someString === someNumber)
andconsole.log(someString === someNumber)
it doesn't fail at all.I consider this is especially important due to the following two facts:
The text was updated successfully, but these errors were encountered: