API reference › @evolu/common › Types › DistributiveOmit

type DistributiveOmit<T, K extends PropertyKey> = T extends unknown
  ? Omit<T, K>
  : never;

Defined in: packages/common/src/Types.ts:509

Removes keys from each member of a union.

Use when Omit would collapse a discriminated union into a single shared shape.

Preserving discriminated unions

import { assertType, type DistributiveOmit } from "@evolu/common";

type Event =
  | { type: "a"; a: string; shared: number }
  | { type: "b"; b: number; shared: number };

type Payload = DistributiveOmit<Event, "shared">;

assertType<Payload, { type: "a"; a: string } | { type: "b"; b: number }>();