Type Alias PartialExcept<T, K>

PartialExcept<T, K>: Partial<Omit<T, K>> & Pick<T, K>

Makes properties optional except specified keys

Type Parameters

  • T

    Original type

  • K extends keyof T

    Keys to keep required

interface User {
id: number;
name: string;
}

type PartialUser = PartialExcept<User, 'id'>;
// Results in: { id: number; name?: string; }