How to make an array immutable or read-only in TypeScript?
Originally Published Here ๐!
To make an array immutable or read-only, one of the straightforward ways to achieve is to use the as const syntax after the array itself in TypeScript.
TL;DR
// array of numbers
// the array is now immutable or readonly
...
melvingeorge-me.hashnode.dev2 min read