title: How to remove TS2722: Cannot invoke an object which is possibly 'undefined'. error?
body: <p>I have a function looking like this</p>
  
  <pre><code>let bcInst;
  if(props.onBoundsChanged){
      bcInst = kakao.maps.event.addListener(map, 'bounds_changed',()=&gt;{
          props.onBoundsChanged(map); //I get error here
      })
  }
  </code></pre>
  
  <p>props interface looking like below</p>
  
  <pre><code>interface IMapProps{
      mapId?: string;
      longitude: number;
      latitude: number;
      level:number;
      onBoundsChanged?:{
          (map:any) : void
      }
  }
  </code></pre>
  
  <p>Even if I am checking for props.onBoundsChanged in an if statement, I am getting TS2722: Cannot invoke an object which is possibly 'undefined'. error at the position I am using props.onBoundsChanged. How do I solve this issue?</p>