New rule: use type parameter for .reduce instead of a cast 8000 #1604
Labels
enhancement: new plugin rule
New rule request for eslint-plugin
has pr
there is a PR raised to close this
package: eslint-plugin
Issues related to @typescript-eslint/eslint-plugin
Uh oh!
There was an error while loading. Please reload this page.
Repro
Expected Result
Typo! It should beAh, this does fire a TS error, thanks - updated the sample.Record<string, boolean>
, but because we're using a cast, it's missed.Also, uUsing a cast is unnecessary becauseArray#reduce
can take in a type parameter indicating the default value & return type. The above code would be better written as:Actual Result
No error.
Versions
@typescript-eslint/eslint-plugin
2.7.0
@typescript-eslint/parser
2.7.0
TypeScript
3.7.3
ESLint
5.15.1
node
12.4.0
npm
6.9.0
The text was updated successfully, but these errors were encountered: