Dev Helpers
← Back

Exclude an internal field

Exclude an internal field using TypeScript.

Open this example in the interactive library

Source code

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));

Sample output

{ id: 1, name: 'Build' }