What does `as const` do to an object literal in TypeScript?

TypeScript Professional Hard

TypeScript Professional — Hard

What does `as const` do to an object literal in TypeScript?

Key points

  • `as const` narrows down the types of properties
  • Makes properties readonly
  • Ensures immutability of the object

Ready to go further?

Related questions