TypeScript: optional chaining reduces guard noise
typescriptpatterns
Use ?. when values may be null/undefined.
const city = user?.address?.city ?? 'Unknown'; Use ?. when values may be null/undefined.
const city = user?.address?.city ?? 'Unknown';