/** * Make all nested properties in T writeable. This type reverses the effects of the * `readonly` modifier and is the opposite of the `Readonly` type. * * @template T The type to make writeable * @returns A new type with all properties in T writeable * @example Writeable<{ readonly a: string; b: { readonly c: number } }> // { a: string; b: { c: number } } */ type WriteableDeep = T extends object ? T extends ReadonlyArray ? Array> : { -readonly [P in keyof T]: WriteableDeep; } : T; export type { WriteableDeep };