Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 843 Bytes

File metadata and controls

30 lines (21 loc) · 843 Bytes

Home > types-kit > SetMutable

SetMutable type

Make some properties in T mutable (remove readonly decorator).

Signature:

export type SetMutable<T, K extends Keys<T>> = Simplify<
  StrictOmit<T, K> & Mutable<Pick<T, K>>
>

References: Keys, Simplify, StrictOmit, Mutable

Example

interface Props {
     readonly a: number;
     readonly b: number;
     readonly c: number;
   };
   // Expect: {  a: number; b: number; readonly c: number; }
   type NewProps = SetMutable<Props, 'a' | 'b'>;