I am working on integrating maps in my react project. I am getting some errors. I used typescript in my project.
Below is a code which shows error:
handleChange = (e:any) => {
    this.setState({location: this.state.location})
     function initAutocomplete() {
       var input = document.getElementById('pac-input')! as HTMLInputElement;
       var searchBox = new window.google.maps.places.SearchBox(input); 
       searchBox.addListener('places_changed', function() {
         this.setState({ PlaceName: document.getElementById('pac-input').value });
               ^//---------------------#1
       });
     }
   
     initAutocomplete();
 }
This is error which I am facing:
#1 : Property 'setState' does not exist on type 'SearchBox'.ts(2339)
 
     
    