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.
Worked example
interface Job {
id: number;
name: string;
done: boolean;
}
const job: Job = { id: 1, name: "Build", done: false };
console.log((({ id, name }: Pick<Job, "id" | "name">) => ({ id, name }))(job));Result
{ id: 1, name: 'Build' }Implementation notes
Returning references to nested fields can expose mutable internal values. Decide whether the public projection needs copied or immutable descendants.
Try it yourself
Serialize the projected object and inspect its actual keys.
Open the TypeScript example →Editorial date June 8, 2026 · Published December 6, 2026