Dev Helpers

TypeScript / Object types

Exclude an internal field

Dev Helpers · March 2, 2026

Omit describes a narrower type at compile time. Removing an internal field from a payload also requires a runtime projection or destructuring step.

Worked example

interface Job {
  id: number;
  name: string;
  done: boolean;
}
const job: Job = { id: 1, name: "Build", done: false };
console.log((({ done, ...summary }: Job): Omit<Job, "done"> => summary)(job));

Result

{ id: 1, name: 'Build' }

Implementation notes

Deleting a property from a shared object can affect other consumers. A new projected object gives serialization its own boundary.

Try it yourself

Inspect the outgoing JSON for a record that still carries its private property.

Open the TypeScript example →

Editorial date March 2, 2026 · Published December 6, 2026

Related articles

Create an object with a computed flag

A computed property name derives an object's key from a runtime value. Keep its allowed names narrow if downstream readers expect a fixed set.

Read a typed property

A typed property read can couple a key to the shape of its record. That relationship catches misspellings before they become missing runtime values.

Pick two public fields

A public projection should explicitly copy the fields meant for its consumer. A narrower type annotation alone does not remove fields from a runtime object.