you can just say `ev && ev.type` instead of using ternary opeartor