Intermediate TypeScript
Q79 / 100

What does the "as const" assertion do when applied to an array literal, e.g. "const arr = [1, 2, 3] as const"?

Correct! Well done.

Incorrect.

The correct answer is B) It infers the array as a readonly tuple of literal types instead of a mutable number[]

B

Correct Answer

It infers the array as a readonly tuple of literal types instead of a mutable number[]

Explanation

"as const" on an array literal produces a readonly tuple type with literal element types (readonly [1, 2, 3]) rather than the wider number[].

Progress
79/100