Skip to content

zoom Props causing typescript errors #511

Open
@dahfool

Description

@dahfool

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)````

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions