Do not classify Infinity and NaN#44778
Merged
orta merged 4 commits intomicrosoft:mainfrom Aug 4, 2021
Merged
Conversation
jeanp413
commented
Jun 28, 2021
Comment on lines
+228
to
+231
| function isInfinityOrNaNString(name: __String): boolean { | ||
| return name === "Infinity" || name === "-Infinity" || name === "NaN"; | ||
| } | ||
|
|
Contributor
Author
There was a problem hiding this comment.
Not sure if there's a better way to check for Infinity and NaN, I copied this from checker.ts line 26202.
Let me know if there's a better way to fix this.
orta
approved these changes
Jul 19, 2021
DanielRosenwasser
requested changes
Jul 19, 2021
Member
DanielRosenwasser
left a comment
There was a problem hiding this comment.
Sorry, I thought we'd have to expose something from the checker, but the logic is exactly the same as that of the type-checker. I think I'm going to need to back-pedal a bit and suggest to just check against Infinity and NaN, since exposing another API now seems overkill.
On that note, could you add these cases to the existing test?
// Regular properties
const obj1 = {
Infinity: 100,
NaN: 200,
"-Infinity": 300
};
obj1.Infinity;
obj1.NaN;
obj1["-Infinity"];
// Shorthand properties
const obj2 = {
Infinity,
NaN,
}
obj2.Infinity;
obj2.NaN;
Contributor
|
Cool, improved the tests and made it only check for "Infinity" and not |
DanielRosenwasser
approved these changes
Aug 3, 2021
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Fixes #42022