In below code TypeScript does not believe that if customMessage is undefined, className is NOT undefined:
customMessage
undefined
className