participant?.id || "no-id-given";
const participant:{id?:string}={};
const a = participant?.id || "no-id-given";
would be all equivalent.
For unions, you can only use properties/methods that are valid for all sides of the union. That is until you type narrow. if ("id" in participant) { console.log(participant.id); } I think that won't throw an error
Обсуждают сегодня