google-maps-react this.props.google does not exist in type

Viewed 1074

I am trying to follow the example from https://github.com/fullstackreact/google-maps-react#readme and I got this error

Property 'google' does not exist on type 'Readonly<{ children?: ReactNode; }> & Readonly<IGoogleMapProps>'.

The imports

import * as React from "react";
import styles from "./GoogleMap.module.scss";
import { IGoogleMapProps } from "./IGoogleMapProps";
import { escape } from "@microsoft/sp-lodash-subset";
import { Map, InfoWindow, Marker, GoogleApiWrapper } from "google-maps-react";
import PropTypes from 'prop-types';

export class GoogleMap extends React.Component<
  IGoogleMapProps,
  {}
  > {




The render method

 <Map
style={{ width: '100%', height: '100%' }}
google={this.props.google}
centerAroundCurrentLocation={true}
zoom={20}
/>

Webpart.ts


  public render(): void {
    this.properties.list = this.properties.dropdownProperty;
    const element: React.ReactElement<IGoogleMapProps> = React.createElement(
      GoogleMap,
      {
        description: this.properties.description,
        context: this.context,
        spHttpClient: this.context.spHttpClient,
        API_KEY: this.properties.API_KEY,
        lat: this.properties.lat,
        lng: this.properties.lng,
        list: this.properties.list,
        dropdownProperty: this.properties.dropdownProperty,
        google: any //  'any' only refers to a type, but is being used as a value here.
      }
    );

May I know what is the parameter google takes? Where is it defined? is there a workaround to make this data?

0 Answers
Related