type widening

The compiler giving a value a broader type than its exact value, such as string instead of "production", because it might change later.

In more detail

let variables and object properties are widened because they can be reassigned. Widening loses the exact values you may want to check later. as const, const type parameters and satisfies are ways to keep the narrow literal types.

Related terms

Taught in

References