Enforce using type parameters when calling Array#reduce instead of type assertions.
// code-linter.json5
{
"rules": {
"@typescript-eslint/prefer-reduce-type-parameter": "error"
}
} ['1', '2', '3'].reduce<readonly string[]>((arr, text) => {
const newArr = [...arr];
newArr.push(text);
return newArr;
}, []); ['1', '2', '3'].reduce((arr, text) => {
const newArr = [...arr];
newArr.push(text);
return newArr;
}, [] as readonly string[]); plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.