google-maps -реагировать this.props.google не существует в типе - PullRequest
1 голос
/ 24 марта 2020

Я пытаюсь следовать примеру из https://github.com/fullstackreact/google-maps-react#readme, и я получил эту ошибку

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

Импорт

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,
  {}
  > {




Метод рендеринга

 <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.
      }
    );

Могу ли я узнать, какой параметр принимает Google? Где это определено? Есть ли обходной путь, чтобы сделать эти данные?

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...