Skip to content

TypeAlias.DeepPartial

github-actions[bot] edited this page Jul 8, 2026 · 34 revisions

umt / DeepPartial

Type Alias: DeepPartial<T>

DeepPartial<T> = T extends Record<PropertyKey, any> ? { [P in keyof T]?: DeepPartial<T[P]> } : T

Defined in: types/logic/deepPartial.ts:36

Recursively makes all properties in T optional, including nested objects. Unlike TypeScript's built-in Partial which only affects top-level properties, DeepPartial applies the optional modifier to all levels of nested objects.

Type Parameters

T

T

The type to make deeply partial

Example

interface User {
  id: number;
  profile: {
    name: string;
    address: {
      street: string;
      city: string;
    };
  };
}

type PartialUser = DeepPartial<User>;
// Result:
// {
//   id?: number;
//   profile?: {
//     name?: string;
//     address?: {
//       street?: string;
//       city?: string;
//     };
//   };
// }

API

Classes

Interfaces

Type Aliases

Variables

Functions

Clone this wiki locally