Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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). #1892

Closed
argelj289 opened this issue Oct 6, 2020 · 29 comments

Comments

@argelj289
Copy link

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]>;
@riccardomassa
Copy link

Same error, Angular V9, fresh install

@Foreverdie
Copy link

Hello,

What is your AGM version ?

@riccardomassa
Copy link

riccardomassa commented Oct 6, 2020 via email

@Foreverdie
Copy link

Yep, i've got the same error since i updated @types/googlemaps...

@Foreverdie
Copy link

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

@riccardomassa
Copy link

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

@ghost
Copy link

ghost commented Oct 6, 2020

it worked thanks

@jimmykane
Copy link

For me it was also @googlemaps/markerclustererplus that got an update

@tarlepp
Copy link

tarlepp commented Oct 8, 2020

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)

@kalpeshrajpurohit
Copy link

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

@diegoazh
Copy link

diegoazh commented Jan 26, 2021

Is it any plan to update this type to the latest version of @types/googlemaps?

PowerKiKi added a commit to unil-lettres/dilps-tiresias that referenced this issue Feb 17, 2021
Except @types/googlemaps which is stuck in the past because of
sebholstein/angular-google-maps#1892
@Naga121
Copy link

Naga121 commented Feb 18, 2021

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

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

@guri1497
Copy link

guri1497 commented Mar 4, 2021

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.<3

@EfratIfergan
Copy link

@guri1497 for me, too, it solved the problem😊

@hamzahsn
Copy link

I have the same issue, but a weird one, the normal build working fine for me with ng build --prod but when I build my Docker image then I have this issue!

BTW:

"@types/googlemaps": "3.39.12",
"@agm/core": "^3.0.0-beta.0",
"@angular/core": "~10.1.1",

Any similar behavior?

@EfratIfergan
Copy link

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

@hamzahsn
Copy link

@EfratIfergan I have tried them both actually but did not work

@shamsi2u
Copy link

shamsi2u commented May 1, 2021

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

this worked for me

@yisalk
Copy link

yisalk commented May 20, 2021

I am also getting the same error. I am trying to upgrade the @types/googlemaps version from 3.39.13 to 3.43.3.
My agm version is "@agm/core": "^3.0.0-beta.0". Is there anybody who can help me?
Thanks

@Avinash-NOCPL
Copy link

It really worked for me too thanks Developers : npm i @types/googlemaps@3.39.13

@deeppatidar05
Copy link

I have the same issue and was not resolved by executing the above all solutions. Dependencies I have
"dependencies": {
"@agm/core": "^3.0.0-beta.0",
"@angular/animations": "^10.1.6",
"@angular/cdk": "^12.1.1",
"@angular/common": "~10.1.2",
"@angular/compiler": "~10.1.2",
"@angular/core": "^10.2.5",
"@angular/forms": "~10.1.2",
"@angular/platform-browser": "~10.1.2",
"@angular/platform-browser-dynamic": "~10.1.2",
"@angular/router": "~10.1.2",
"@ng-bootstrap/ng-bootstrap": "^8.0.0",
"@ng-select/ng-select": "^5.0.9",
"@ngrx/core": "^1.2.0",
"@ngrx/effects": "^8.6.1",
"@ngrx/entity": "^12.2.0",
"@ngrx/router-store": "^8.6.0",
"@ngrx/store": "^8.6.0",
"@ngrx/store-devtools": "^8.6.0",
"@types/crypto-js": "^4.0.2",
"angular-cc-library": "^2.1.2",
"angular-highcharts": "^10.0.1",
"angular-ng-autocomplete": "^2.0.5",
"angular-ng-stepper": "^1.0.6",
"apexcharts": "^3.22.2",
"bootstrap": "^4.0.0",
"bs-stepper": "^1.7.0",
"canvasjs": "^1.8.3",
"chart.js": "^2.9.4",
"crypto-js": "^3.1.9-1",
"highcharts": "^8.2.2",
"i": "^0.3.6",
"jquery": "^3.5.1",
"ng-apexcharts": "^1.5.6",
"ng2-charts": "^2.4.2",
"ng2-dragula": "^2.1.1",
"ng5-slider": "^1.2.6",
"ngrx-store-freeze": "^0.2.4",
"ngx-bootstrap": "^6.2.0",
"ngx-chips": "^2.2.2",
"ngx-toastr": "^13.2.1",
"node-sass": "^5.0.0",
"npm": "^7.6.3",
"popper.js": "^1.16.1",
"rxjs": "^6.6.7",
"sweetalert": "^2.1.2",
"tabs": "^0.2.0",
"tslib": "^2.0.0",
"zone.js": "~0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.1001.2",
"@angular/cli": "^10.1.6",
"@angular/compiler-cli": "~10.1.2",
"@types/googlemaps": "^3.39.13",
"@types/jasmine": "~3.5.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.20.16",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~5.0.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"node-sass": "4.5.0",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"tslint": "~6.1.0",
"typescript": "~4.0.2"
}

@lightSerializer
Copy link

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
Copy link

I got these errors after downgrade @types/googlemaps from @3.40.x to @3.39.13

Error: node_modules/@types/googlemaps/index.d.ts:47:22 - error TS6053: File 'E:/GitHub/AngularWorkspace/MADFU-2/adminpanel-new/node_modules/@types/googlemaps/style-reference.d.ts' not found.

47 ///

Error: node_modules/@types/googlemaps/reference/map.d.ts:598:23 - error TS2304: Cannot find name 'MapTypeStyleElementType'.

598 elementType?: MapTypeStyleElementType;

Error: node_modules/@types/googlemaps/reference/map.d.ts:599:23 - error TS2304: Cannot find name 'MapTypeStyleFeatureType'.

599 featureType?: MapTypeStyleFeatureType;

Error: node_modules/@types/googlemaps/reference/map.d.ts:600:19 - error TS2552: Cannot find name 'MapTypeStyler'. Did you mean 'MapTypeStyle'?

600 stylers?: MapTypeStyler[];

× Failed to compile.

@Mohamed-Magdey
Copy link

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

@MhmdWishah
Copy link

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

@MhmdWishah
Copy link

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

Nothing appears in the page and I face this issue now in the console

agm.component.html:19 ERROR TypeError: Cannot read properties of undefined (reading 'then')
at Ae._subscribe (agm-core.js:299:31)
at Ae._trySubscribe (Observable.js:37:25)
at Observable.js:31:30
at l (errorContext.js:19:9)
at Ae.subscribe (Observable.js:22:9)
at agm-core.js:1543:96
at Map.forEach ()
at Te._registerEventListeners (agm-core.js:1542:16)
at Te.ngOnInit (agm-core.js:1493:14)
at U (core.mjs:2434:22)

@Mohamed-Magdey
Copy link

Mohamed-Magdey commented Oct 5, 2023

I think this issue isn't related to what in this thread anymore. It's just a normal angular error 😄

You just need to handle the undefined value in line 19 in agm.component.html as error said.

@MhmdWishah
Copy link

I think this issue isn't related to what in this thread anymore. It's just a normal angular error 😄

You just need to handle the undefined value in line 19 in agm.component.html as error said.

No, It's not a noraml angular error!
I removed the 19 line in my component and still get the error with small differences
It's in (agm-core.js:299:31)

pages-routing.module.ts:54 ERROR TypeError: Cannot read properties of undefined (reading 'then')
at Ae._subscribe (agm-core.js:299:31)
at Ae._trySubscribe (Observable.js:37:25)
at Observable.js:31:30
at l (errorContext.js:19:9)
at Ae.subscribe (Observable.js:22:9)
at agm-core.js:1543:96
at Map.forEach ()
at Te._registerEventListeners (agm-core.js:1542:16)
at Te.ngOnInit (agm-core.js:1493:14)
at U (core.mjs:2434:22)

@Mohamed-Magdey
Copy link

I think this issue isn't related to what in this thread anymore. It's just a normal angular error 😄
You just need to handle the undefined value in line 19 in agm.component.html as error said.

No, It's not a noraml angular error! I removed the 19 line in my component and still get the error with small differences It's in (agm-core.js:299:31)

pages-routing.module.ts:54 ERROR TypeError: Cannot read properties of undefined (reading 'then') at Ae._subscribe (agm-core.js:299:31) at Ae._trySubscribe (Observable.js:37:25) at Observable.js:31:30 at l (errorContext.js:19:9) at Ae.subscribe (Observable.js:22:9) at agm-core.js:1543:96 at Map.forEach () at Te._registerEventListeners (agm-core.js:1542:16) at Te.ngOnInit (agm-core.js:1493:14) at U (core.mjs:2434:22)

Then I couldn't go further without a reproducer for error or the code itself.
If you couldn't share it then try to run the demo example that in docs in your project and see if it works fine with you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests