To avoid errors that a property is undefined when creating or updating a document in firestore, we can use a snipet like this one to have is property added to the object ONLY when the flag is true.
In this example the flag is defined outside optionalContent due to clarity purposes, however we can replace it with !!usesPrinter directly.
const flag = !!usesPrinter
const optionalContent = {
...(flag && {PRINTER_PERMISSION: usesPrinter}),
};
return this.af.doc<Employees>(`EMPLOYEES/${idOrdenVenta}`).update(optionalContent)