Makes specified keys K mutable in each member of a union T.
K
T
This distributes over unions, ensuring each member is processed individually. Only keys that exist in each member are affected.
The target type (can be a union)
Keys to make mutable (defaults to all union keys)
type Result = MakeMutable<{ readonly a: string; readonly b: number }>;// ^?// { a: string; b: number } Copy
type Result = MakeMutable<{ readonly a: string; readonly b: number }>;// ^?// { a: string; b: number }
type Result = MakeMutable<{ readonly a: string } | { readonly b: number }>;// ^?// { a: string } | { b: number } Copy
type Result = MakeMutable<{ readonly a: string } | { readonly b: number }>;// ^?// { a: string } | { b: number }
type Result = MakeMutable<{ readonly a: string } | { readonly b: number }, "a">;// ^?// { a: string } | { readonly b: number } Copy
type Result = MakeMutable<{ readonly a: string } | { readonly b: number }, "a">;// ^?// { a: string } | { readonly b: number }
Makes specified keys
Kmutable in each member of a unionT.This distributes over unions, ensuring each member is processed individually. Only keys that exist in each member are affected.