angular-google-maps: ERROR in node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:51:41 - error TS2314: Generic type 'MapHandlerMap' requires 1 type argument(s).

I encountered error in my terminal when I execute ng build or ng serve:

ERROR in node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:51:41 - error TS2314: Generic type 'MapHandlerMap<T>' requires 1 type argument(s).

51     subscribeToMapEvent<N extends keyof google.maps.MapHandlerMap>(eventName: N): Observable<google.maps.MapHandlerMap[N]>;
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:51:94 - error TS2314: Generic type 'MapHandlerMap<T>' requires 1 type argument(s).

51     subscribeToMapEvent<N extends keyof google.maps.MapHandlerMap>(eventName: N): Observable<google.maps.MapHandlerMap[N]>;

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 29

Commits related to this issue

Most upvoted comments

You can rollback to v3.39.13 of @type/googlemaps (npm i @types/googlemaps@3.39.13)

I encountered error in my terminal when I execute ng build or ng serve:

ERROR in node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:51:41 - error TS2314: Generic type 'MapHandlerMap<T>' requires 1 type argument(s).

51     subscribeToMapEvent<N extends keyof google.maps.MapHandlerMap>(eventName: N): Observable<google.maps.MapHandlerMap[N]>;
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~
node_modules/@agm/core/lib/services/google-maps-api-wrapper.d.ts:51:94 - error TS2314: Generic type 'MapHandlerMap<T>' requires 1 type argument(s).

51     subscribeToMapEvent<N extends keyof google.maps.MapHandlerMap>(eventName: N): Observable<google.maps.MapHandlerMap[N]>;

install

npm install @types/googlemaps@3.39.12 --save-dev

Yes, installing @types/googlemaps@3.39.13 solved the issue.

Yep, same issue here - seems like rollback of @type/googlemaps fixes this.

You can rollback to v3.39.13 of @type/googlemaps (npm i @types/googlemaps@3.39.13)

@hamzahsn you need to change the “@types/googlemaps”: “3.39.12”, to “@types/googlemaps@3.39.13”

You can rollback to v3.39.13 of @type/googlemaps (npm i @types/googlemaps@3.39.13)

thank you so much. it is working for me.❤️

Had the same issue like you guys. Here is what I did and I am able to move forward now

cleared npm cache

  1. Added the below versions through npm “@types/googlemaps”: “3.39.13”, “@agm/core”: “^3.0.0-beta.0”,

  2. updated tsconfig file with the addition of “googlemaps” in the types array “types”: [ “googlemaps” ]

  3. imported the agm module and updated the imports array with google api key in my module file AgmCoreModule.forRoot({ apiKey: “Add your google api key” libraries: [‘places’] })

MhmdWishah Did you try to remove cache? if not then try that:

  1. npm cache clean --force
  2. rm -rf node_modules
  3. npm install

Somehow the project came back to work well without issues in the terminal. I’m gonna try use the components now and let you know if I face any issues. Thanks a lot 4 your help