typelab / utils / ObjectWritable
type ObjectWritable<T, K> = IsObjectLiteral<T> extends true ? Detailed<{ -readonly [Key in K]: T[K] } & { [Key in keyof T as Key extends K ? never : Key]: T[Key] }> : never;Enforce specific properties as writable.
| Type Parameter | Description |
|---|---|
|
|
The original |
|
|
The keys of |
A type with the specified keys of T set as writable.
type Obj = { readonly a: string; b: string };
// WritableObj is { a: string; b: string; }
type WritableObj = ObjectWritable<Obj, 'a'>;