Y
Hacker News
new
|
ask
|
show
|
jobs
by
awestroke
2839 days ago
You don't have to rely on discipline, you can use tooling like ESLint or Flow to make sure there are no implicit conversions in the codebase.
1 comments
TheDong
2839 days ago
eslint absolutely can't figure out whether '==' will implicitly convert its arguments or not.
The type information simply is not there.
link
awestroke
2837 days ago
eslint can disallow == for anything but `== null`. Problem solved.
https://eslint.org/docs/rules/eqeqeq
link
TheDong
2837 days ago
This thread is about not using `===`; it's obviously true that it can be disallowed entirely, but it can't be allowed based on whether or not it will coerce, which was the context of the thread.
link
The type information simply is not there.