Repository navigation
Improve typing for ==, != expressions - #5840
Merged
Merged
Conversation
anandthakker
force-pushed
the
null-equality-expression
branch
from
December 11, 2017 15:55
b01bf49 to
e81519b
Compare
jfirebaugh
approved these changes
Dec 11, 2017
jfirebaugh
left a comment
Contributor
There was a problem hiding this comment.
Per chat, add the alternatives considered and rationale for choosing this one for future us to refer to.
| } | ||
|
|
||
| possibleOutputs() { | ||
| return this.lhs.possibleOutputs().concat(this.rhs.possibleOutputs()); |
Contributor
There was a problem hiding this comment.
Should be return [true, false].
anandthakker
pushed a commit
to mapbox/mapbox-gl-native
that referenced
this pull request
Dec 12, 2017
GL JS change: mapbox/mapbox-gl-js#5840 GL Native issue: #10678
anandthakker
added a commit
to mapbox/mapbox-gl-native
that referenced
this pull request
Dec 12, 2017
GL JS change: mapbox/mapbox-gl-js#5840 GL Native issue: #10678
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #5761
Closes #5835
The overloads of == and != are now effectively:
(T1: Comparable, T2: Comparable) => boolean { T1 == T2 }(Comparable, value) => boolean(value, Comparable) => booleanWhere
Comparable = string | number | boolean | null, and evaluation semantics for thevaluecases are equivalent to Javascript's strict equality (===/!==), i.e., when thevalueargument's type doesn't match that of theComparableargument,==evaluates tofalse,!=to true.An alternative, stricter approach we discussed was to keep the signatures above, but to produce an runtime error in the case of a type mismatch between the
valueandComparablearguments -- essentially inserting a type assertion wrapper around thevalueargument. We went with the less strict approach because:==,!=filters==/!=to test fornull(How to test for nulls with new expression syntax? #5761)