Here is the type of the variable
type imageTags: string | number | {
    tag_type: string;
    tag_name: string;
    tag_id: number;
    photo_id: number;
    confidence: number;
}[]
This is how i try to access its properties.
    if (imageTags.length > 0) {
      return imageTags[0].tag_name === image_type;
    }
The variable can be a string , number or array then why am I getting the error Property 'length' does not exist on type 'string | number | { tag_type: string; tag_name: string; tag_id: number; photo_id: number; confidence: number; }[]'. Property 'length' does not exist on type 'number'.ts(2339)
 
     
    