Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Closed
Labels
Milestone
Description
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
- I haveread the FAQ and my problem is not listed.
Repro
{"extends": ["plugin:@typescript-eslint/recommended"]}
typeofwindow===undefinedtypeofwindow===null
Expected Result
error Typeof comparisons should be to string literals valid-typeof
Actual Result
🦗
Additional Info
The@typescript-eslint/recommended
ruleset disables thevalid-typeof
ESLint rule onthe basis that it's covered by TypeScript's "This condition will always return 'false'" handling.
However, this is incorrect:TypeScript does not detect this incorrect condition in the case ofnull
andundefined
, and so thevalid-typeof
rule should be re-enabled in therecommended
preset.
Versions
package | version |
---|---|
@typescript-eslint/eslint-plugin | 4.23.0 |
@typescript-eslint/parser | 4.23.0 |
TypeScript | 4.2.4 |
ESLint | 7.26.0 |
node | 12.13.1 |