I have a piece of data with type:
type OptionType = {value: number | string} | number | string
I’m trying to access the value with:
const finalValue = Object.prototype.hasOwnProperty.call(data, "value") ? value.value : value;
But typescript throws:
Property ‘value’ does not exist on type ‘string | number | OptionType’
Anyone know how to fix this?