google-maps-react icon indicating copy to clipboard operation
google-maps-react copied to clipboard

zoom Props causing typescript errors

Open dahfool opened this issue 4 years ago • 1 comments

I am getting the following typescript error

TS2769: No overload matches this call.   Overload 1 of 2, '(props: IMapProps | Readonly<IMapProps>): Map', gave the following error.     Type '{ google: any; zoom: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Map> & Readonly<IMapProps> & Readonly<{ children?: ReactNode; }>'.       Property 'zoom' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Map> & Readonly<IMapProps> & Readonly<{ children?: ReactNode; }>'.   Overload 2 of 2, '(props: IMapProps, context: any): Map', gave the following error.     Type '{ google: any; zoom: number; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Map> & Readonly<IMapProps> & Readonly<{ children?: ReactNode; }>'.       Property 'zoom' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Map> & Readonly<IMapProps> & Readonly<{ children?: ReactNode;

The code

import { Map, GoogleApiWrapper, GoogleAPI } from 'google-maps-react'

export class MapContainer extends Component<GoogleAPI> {
  render() {
    if (!this.props.google) {
      return <div>Loading...</div>
    }

    return (
      <div
        style={{
          position: 'relative',
          height: 400,
        }}
      >
        <Map google={this.props.google} zoom={1} />
      </div>
    )
  }
}
export default GoogleApiWrapper({
  apiKey: '',
})(MapContainer)````

dahfool avatar Apr 27 '21 11:04 dahfool

using: "@types/google-maps-react": "^2.0.5", "google-maps-react": "^2.0.6",

dahfool avatar Apr 27 '21 11:04 dahfool