How to clone an object in TypeScript?

I’m trying to pass a modified clone of an object credential.user to a function

const credential = await this.afAuth.auth.signInWithEmailAndPassword(email,password);
var userInfo=  await credential.user

userInfo.displayName=  name

return this.updateUserData(userInfo);

however I am getting this message:

ERROR Error: Uncaught (in promise): TypeError: "displayName" is read-only

How can I clone this object received from an async function and modify one of its attributes?

Source: Angular Questions