const

The JavaScript keyword that declares a variable which cannot be reassigned.

In more detail

Because a const variable holding a primitive can never change, TypeScript infers its exact literal type. The object a const variable points to can still be changed; use readonly or as const for that. const also appears in as const and in const type parameters, which are separate TypeScript features.

Related terms

Taught in

References