Explain 'Const Type Parameters' (TS 5.0+).

Updated May 4, 2026

Short answer

Allows a generic function to infer literal types from its arguments without requiring the user to use 'as const' at the call site.

Deep explanation

Before TS 5.0, if you wanted a function to infer the literal values of an array or object passed to it, the caller had to append as const. With const T, the compiler automatically applies as const logic to the inference of that generic parameter. This makes APIs much cleaner and prevents 'type widening' by default within that specific function scope.

Unlock with a Pro subscription to view this section.

View pricing

Real-world example

No real-world example available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Common mistakes

No common mistakes listed yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

Follow-up questions

No follow-up questions available yet.

Unlock with a Pro subscription to view this section.

Upgrade to Pro

More TypeScript interview questions

View all →