Code like the below appears in TypeScript's test runner; an array is used to collect error messages, which are joined and thrown when non-empty. But, error-message
thinks that this error list could be empty (though the length is checked) and errors.
const errs = [];
if (someCondition) {
errs.push("hello");
}
if (errs.length) {
throw new Error(errs.join("\n "));
}
(Personally, I think that this check is a little too strong; it's not clear that a linter can really "prove" that an array is or isn't empty, so using that info in the lint feels iffy. But, there's a length check, which is theoretically enough for this case.)
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too