TypeScript Utility Types

Partial<T> — optional property transformation

Partial describes a patch that may supply any subset of a source object’s properties. It preserves property value types and readonly modifiers, but only makes the immediate properties optional. Nested objects retain their original required members. It is not a runtime merge or a deep patch; absent and explicitly undefined properties can differ under exactOptionalPropertyTypes. Example output: "Draft true". Verified with strict TypeScript 5.8.3, ES2022 and Node.js 22.16.0. This utility affects static typing; no runtime validation or transformation is supplied by the type itself.

Formal Syntax & Structure

typescript syntaxtypescript
Partial<T>

Parameters & Attributes

NameTypeDescription
Ttype parameterSource type whose immediate properties become optional.

Working Example

Example Snippettypescript
type Settings = { title: string; enabled: boolean };const base: Settings = { title: "Draft", enabled: false };const patch: Partial<Settings> = { enabled: true };const next: Settings = { ...base, ...patch };console.log(next.title, next.enabled);
TypeScript Reference