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
@ChrisLoer points out that the documentation for "==" could be a bit confusing. The docs say:
Equality is strictly typed: values of different types are always considered not equal
That is true for, e.g., ["==", ["get", "x"], 10] applied to {properties: {x: "10"}}. However, it's not true for an expression like ["==", "10", 10], which actually fails to typecheck with the message Cannot compare string and number. This error message appears to be in contradiction with the docs.
Let's clarify the message to something like:
Cannot compare ${toString(lhs.type)} and ${toString(rhs.type)}: since these types are different, "==" would always return false. Consider using "to-${toString(lhs.type)}" or "to-${toString(rhs.type)}" in order to compare two values of the same type.
The text was updated successfully, but these errors were encountered:
@ChrisLoer points out that the documentation for
"=="
could be a bit confusing. The docs say:That is true for, e.g.,
["==", ["get", "x"], 10]
applied to{properties: {x: "10"}}
. However, it's not true for an expression like["==", "10", 10]
, which actually fails to typecheck with the messageCannot compare string and number.
This error message appears to be in contradiction with the docs.Let's clarify the message to something like:
The text was updated successfully, but these errors were encountered: