You can use the existential operator, which checks for null and undefined: `if userhistory?`