import type { IsBrand } from './brand'; /** * Mutable type with recursive applying. * `DeepMutable<{readonly foo: {readonly bar: 0}}>` = `{foo: {bar: 0}}`. */ export type DeepMutable = keyof Type extends never ? Type : IsBrand extends true ? Type : { -readonly [Key in keyof Type]: DeepMutable; }; /** * Partial type with recursive applying. * `DeepPartial<{foo: {bar: 0}}>` = `{foo?: {bar?: 0}}`. */ export type DeepPartial = keyof Type extends never ? Type : IsBrand extends true ? Type : { [Key in keyof Type]?: DeepPartial; }; /** * Readonly type with recursive applying. * `DeepReadonly<{foo: {bar: 0}}>` = `{readonly foo: {readonly bar: 0}}`. */ export type DeepReadonly = keyof Type extends never ? Type : IsBrand extends true ? Type : { readonly [Key in keyof Type]: DeepReadonly; }; /** * Required type with recursive applying. * `DeepRequired<{foo?: {bar?: 0}}>` = `{foo: {bar: 0}}`. */ export type DeepRequired = keyof Type extends never ? Type : IsBrand extends true ? Type : { [Key in keyof Type]-?: DeepRequired>; };