2

In Material-UI documentation there is an example of how to use Autocomplete with Google Maps.

Everything works fine, but there are couple of any. My project has strict policies on using any, so I would like to get rid of them (or have justification if it's unavoidable).

While I could get rid of some of them, in this part I couldn't find a solution how to remove or replace them with proper types.

if (!autocompleteService.current && (window as any).google) {
  autocompleteService.current = new (window as any).google.maps.places.AutocompleteService();
}

Is there a way to avoid using any here?

(Here is link to Autocomplete demo on codesandbox)

  • this may be a duplicate of https://stackoverflow.com/questions/12709074/how-do-you-explicitly-set-a-new-property-on-window-in-typescript – ye-olde-dev Dec 22 '20 at 18:09

0 Answers0