DEV Community

Cover image for TypeScript Secrets Part 1: "as const"

TypeScript Secrets Part 1: "as const"

Çetin Kaan Taşkıngenç on January 30, 2024

I've been wanting to start a new blog series for a while now. In this series, I'll be sharing some lesser-known TypeScript features that many web d...
Collapse
 
jwhenry3 profile image
Justin Henry

If you want complete safety from mutations, you may want to Object.freeze all the inner objects and then also the outer object. This will prevent unwanted changes to the values so you can move with reassurance that your type definition is more accurate.