add this before calling functions that consists of geocoder to ensure the specific constructor is intialized.
google.maps.importLibrary("geocoding").then(() => { //Call your function here }