You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As explained in #2124, truthy/falsy values can lead to subtle bugs, and while the other issue deals with enforcing the abstention of using it in expressions, this issue converts any such case where a && a.b && a.b.c && a.b.c.d happens, and instead suggests to coalece it to a?.b?.c?.d, while not checking for truthy values inbetween, but explicitly for nullability.
Enabling it would help developers to more ergonomically and correctly write code that works with nullable variables, properties, functions, etc.
https://typescript-eslint.io/rules/prefer-nullish-coalescing/
https://typescript-eslint.io/rules/prefer-optional-chain/
These discourage falsy/truthy checking, and actually check for undefined or null.
This'd help if a parameter is
number | null
/idx?: number
, to not branch on0
.The text was updated successfully, but these errors were encountered: