js-waku icon indicating copy to clipboard operation
js-waku copied to clipboard

chore: prevent unchecked index access

Open weboko opened this issue 10 months ago • 1 comments

Problem

When access happens by index it is possible to hit a case when no value returned. With no proper handling of such edge case it's easy to hit a problem in run time and increase amount of problems for consumers. Examples of such issue is here - https://github.com/waku-org/js-waku/issues/1562

Solution

Enable TypeScript to check for such a case

Notes

  • Link https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-1.html#checked-indexed-accesses---nouncheckedindexedaccess

weboko avatar Sep 25 '23 23:09 weboko