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({ ...job, done: job.name.length > 0 } satisfies Job);
Sample output
{ id: 1, name: 'Build', done: true }