get value from correct union type
correct equality check