Update index.ts

This commit is contained in:
Sindre Sorhus 2024-09-06 22:47:52 +07:00 committed by GitHub
parent d77be18d42
commit b177d02e3a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1149,11 +1149,10 @@ export function assertArray<T = unknown>(value: unknown, assertion?: (element: u
}
if (assertion) {
// eslint-disable-next-line unicorn/no-array-for-each
value.forEach(v => {
for (const element of value) {
// @ts-expect-error: "Assertions require every name in the call target to be declared with an explicit type annotation."
assertion(v, message);
});
assertion(element, message);
}
}
}