DEV Community

Discussion on: 3 TypeScript Tricks I wish I knew when I learned TypeScript

Collapse
anuraghazra profile image
Anurag Hazra

In the first example, you don't need to use two generics to define readonly arrays.

You can simply use the built-in ReadonlyArray<number> generic

Collapse
cstrnt profile image
Tim Raderschad Author

That's right! I just like the simplicity of only needing to memorize one keyword which then can be used with all types :)