TypeScript · Middle · Question 27 of 75
What do -readonly and -? do in a mapped type?
type Mutable<T> = { -readonly [K in keyof T]-?: T[K] };- ✓Correct answer: Remove the
readonlyand?modifiers from all properties - 2Add the
readonlyand?modifiers to all properties - 3Delete the properties marked
readonlyfrom the type
Explanation
The - prefix removes a modifier, + (the default) adds it. That's how Required<T> is implemented (-?). There's no built-in Mutable, but it's often written following this pattern.