Skip to content

Proposal: DistributiveOmit #1395

@salisbury-espinosa

Description

@salisbury-espinosa

Type description + examples

import { IsUnion } from 'type-fest';

type _DistributiveOmit<T, K extends keyof any> = T extends any 
  ? Omit<T, K> 
  : never;

type DistributiveOmit<T, K extends keyof any> = IsUnion<T> extends true
  ? _DistributiveOmit<T, K> // Distribute if it's a union
  : Omit<T, K>;       // Standard omit otherwise

Type source

No response

Search existing types and issues first

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions