Mutates the type by adding the readonly modifier and the optional modifier (?) to all properties.
readonly
?
The type to mutate.
type Original = { name?: string; age?: number };type Mutated = ReadonlyPartial<Original>; // { readonly name?: string; readonly age?: number } Copy
type Original = { name?: string; age?: number };type Mutated = ReadonlyPartial<Original>; // { readonly name?: string; readonly age?: number }
Mutates the type by adding the
readonly
modifier and the optional modifier (?
) to all properties.