Advanced TypeScript
Q84 / 100

Given "type DeepReadonly<T> = { readonly [K in keyof T]: T[K] extends object ? DeepReadonly<T[K]> : T[K] }", what does this mapped type achieve?

Correct! Well done.

Incorrect.

The correct answer is B) Recursively applies readonly to all nested object properties

B

Correct Answer

Recursively applies readonly to all nested object properties

Explanation

This recursive mapped type applies readonly to every property and recurses into nested object types, producing a deeply immutable type.

Progress
84/100