declare const foo: string[];
declare const doThingWithIndex: (index: number) => void;
foo.forEach((value, index) => { // error: unicorn/no-array-for-each
console.log(value);
doThingWithIndex(index);
});
there's no good way to convert this to a for loop:
for (const index in foo) { // now triggers new errors: guard-for-in, typescript/no-for-in-array
const value = foo[index]
doThingWithIndex(index); // type error, because index is a string
}
there's no good way to convert this to a
forloop: