Complete worked example
typescript
type Role = { id: string; title: string; remote: boolean };
type Patch = Partial<Pick<Role, "title" | "remote">>;
function edit(role: Role, patch: Patch): Role { return { ...role, ...patch }; }
const updated = edit({id:"a",title:"QA",remote:false},{remote:true});- Reasoning
- The patch vocabulary is finite and deliberately excludes the immutable id field.