问题
I wanted to integrate Google Maps with my Angular project. In the pilot version, I was just following this link https://angular-maps.com/guides/getting-started/. Currently, I am stuck in error:
node_modules/@agm/core/lib/directives/map.d.ts:232:43 - error TS2694: Namespace 'google.maps' has no exported member 'MouseEvent'
232 mapDblClick: EventEmitter<google.maps.MouseEvent>;
I went to the file location and got this
mapClick: EventEmitter<google.maps.MouseEvent | google.maps.IconMouseEvent>;
/**
* This event emitter gets emitted when the user right-clicks on the map (but not when they click
* on a marker or infoWindow).
*/
mapRightClick: EventEmitter<google.maps.MouseEvent>;
/**
* This event emitter gets emitted when the user double-clicks on the map (but not when they click
* on a marker or infoWindow).
*/
mapDblClick: EventEmitter<google.maps.MouseEvent>;
/**
Dependencies: npm install @agm/core npm i @types/googlemaps
回答1:
It work around solution found on this github response
"dependencies": {
"@angular/google-maps": "^11.0.0"
}
then add
"devDependencies": {
"@types/googlemaps": "3.39.14"
}
回答2:
I found, that the workaround mentioned in some of the other answers does not work if you are using @agm/core
. I came across the same error when updating to Angular 11.
It seems, that Angular 11 does not work properly in combination with @agm/core 3.0.0-beta.0
(newest version). Try to downgrade @agm/core
to the previous version 1.1.0
. This worked for me.
"dependencies": {
"@agm/core": "^1.1.0"
}
回答3:
none of the above worked for me, my angular version is 10 and as per this the issue is with compatibility of @angular/googlemaps and @types/googlemaps on which angular team is currently working.
回答4:
Guys the solution is already merged,
https://github.com/DefinitelyTyped/DefinitelyTyped/pull/50565#issuecomment-759785211
try installing @types/googlemaps@3.43.2
from npm
.
回答5:
I had same issue with Angular-Cli 11 and "@agm/core": "^3.0.0-beta.0", I resolved by adding @types/googlemaps: "3.39.12" to my devDependencies, now it works !
来源:https://stackoverflow.com/questions/65478922/namespace-google-maps-has-no-exported-member-mouseevent