es-toolkit
Version:
A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.
15 lines • 454 B
TypeScript
//#region src/types/Writable.d.ts
/**
* Removes the `readonly` modifier from all properties of `T`.
* The inverse of the built-in `Readonly`.
*
* @template T - The object type to make writable.
*
* @example
* type Config = { readonly host: string; readonly port: number };
* type MutableConfig = Writable<Config>;
* // => { host: string; port: number }
*/
type Writable<T> = { -readonly [K in keyof T]: T[K] };
//#endregion
export { Writable };