TypeScript Tip #1: forEach vs for loop
While working on a typescript project, it is recommended to enable noUncheckedIndexedAccess for safer object access. The difference it makes can be summarised below: const obj : Record<string,number[]> = {}; obj.nonExistentKey.push(2); Without enabling the flag the above will not throw an error. Above is a trivial example but I hope it shows the importance of…