Advanced
TypeScript
Q98 / 100
What does the utility type combination "type Mutable<T> = { -readonly [K in keyof T]: T[K] }" do with the "-readonly" modifier?
Correct! Well done.
Incorrect.
The correct answer is B) It removes the readonly modifier from all properties of T, producing a mutable version of the type
B
Correct Answer
It removes the readonly modifier from all properties of T, producing a mutable version of the type
Explanation
Mapped type modifiers can be prefixed with "-" to remove them; "-readonly" strips the readonly modifier from every property, yielding a fully mutable version of T.
Progress
98/100