-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error on syntactically impossible ===s to undefined #60433
base: main
Are you sure you want to change the base?
Conversation
Error message is just a placeholder so I can run top800
@typescript-bot test it |
@RyanCavanaugh Here are the results of running the user tests with tsc comparing Something interesting changed - please have a look. Details
|
Hey @RyanCavanaugh, the results of running the DT tests are ready. Everything looks the same! |
@RyanCavanaugh Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
@typescript-bot test top800 |
@RyanCavanaugh Here are the results of running the top 400 repos with tsc comparing Something interesting changed - please have a look. Details
|
Webpack had two instances of this (both of which had lint suppressions which were applied in a routine dep upgrade) if (!this._redirectTo !== undefined) { javascript-obfuscator had public static isNode (object: Object & { type?: string }): object is ESTree.Node {
return object && !object.type !== undefined;
} Everything else was some variant of
There was also a false positive, #60439 |
@RyanCavanaugh Here are the results of running the top 800 repos with tsc comparing Something interesting changed - please have a look. Details
|
|
Both <Div dashed={typeof props.llm === undefined}> {typeof modelOptions.apiKey !== undefined && |
update: gotcha, you're saying they're bugs in this PR, which i agree with :-) |
aha, you are of course correct :-) |
Does this PR seem likely to land? |
I recommend just adding a lint rule; not sure if we'll try to land this or not. Last time we added checks like this there were a lot of people responding with "But I wrote that [non-working] code on purpose" so I have slightly less appetite for pushing on this right now. |
Can you add this case? |
Thanks for the response. I sympathize. We get that kind of pushback from our users, also. On the other hand, it seems like all but one of the cases found in your testing are actually broken code. That one false positive was due to a different bug in TSC, which you've now fixed. Do you expect there to be cases where doing |
I wonder about the reason behind this because a type error is also a code "not working". Why we will check something as a type error and other cases don't? |
@@ -110,6 +116,8 @@ comparisonOperatorWithIdenticalPrimitiveType.ts(43,24): error TS18050: The value | |||
var rf5 = e != e; | |||
var rf6 = null != null; | |||
var rf7 = undefined != undefined; | |||
~~~~~~~~~ | |||
!!! error TS2870: This binary expression is never nullish. Are you missing parentheses? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would we get this error here? Surely undefined
is always nullish?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i mean, when it's not ES5, or not the global scope, it could be any value, but presumably TS is ignoring that possibility :-)
Not a fully-correct implementation yet. Error message is just a placeholder so I can run top800 and see who's comparing what to
undefined