12$: diagnostic: typeof operator should warn when comparing to invalid string literals #1213
Labels
for hire
Get paid for working on this task: https://quick-lint-js.com/hiring.html
good first issue
Good for newcomers and C++ beginners
When performing checks like
typeof x == "string"
, it is perfectly possible to misspell it as something liketypeof x == "strng"
(missingi
), which will always return false. Maybe there should be a warning for this?More generally, expressions of the form
typeof <a> [== or != or === or !==] <b>
where b is a string and not"undefined"
,"object"
,"boolean"
,"number"
,"bigint"
,"string"
,"symbol"
or"function"
I would be happy to implement this if approved and no-one else wants to :)
The text was updated successfully, but these errors were encountered: