Home > Back-end >  typescript error: Object is possibly 'undefined'. when sorting array based on the contents
typescript error: Object is possibly 'undefined'. when sorting array based on the contents

Time:11-12

the error is currEmot is possibly undefined. I'm confused why that is occurring because the for loop is guaranteed to loop through the emotionsObject and add objects to the map.

let emotionsObject = [
{
    size: 80,
    background: 'rgb(67, 0, 128)',
    width: .5,
    emoji: "           
  • Related