Partial<T>

A utility type that constructs a type with all properties of T set to optional. Useful for update operations.

Syntax

typescript
Partial<Type>

Example

typescript
interface Config {
  host: string;
  port: number;
  debug: boolean;
}

function updateConfig(config: Config, updates: Partial<Config>): Config {
  return { ...config, ...updates };
}

updateConfig(defaultConfig, { port: 3001 });