I'm looking for a neat way to conditionally concatenate strings.
See:
const something = response.data
  .map(i => {
    const id = i.Attachments?.[0]?.Id
    return { image: id ? "/servlet/servlet.FileDownload?file=" + id : undefined, ...i }
  })
I'd love to inline this, but can't find a way. Using null coelescing op like ('something' + foo) ?? undefined is never resolved to undefined.
Edit: I'd like to minimise this to something like .map(i => ({image: "/servlet/servlet.FileDownload?file=" + i.Attachments?.[0]?.Id, ...i})) but image to be empty if there's no Id. I hope there's a neat trick somewhere.
 
     
     
    