命名空间"google.maps"没有导出的成员"MouseEvent" [英] Namespace 'google.maps' has no exported member 'MouseEvent'
问题描述
我想将Google Maps与我的Angular项目集成在一起.在试用版中,我只是点击此链接 https://angular-maps.com/guides/入门/ .目前,我陷入了错误:
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-错误TS2694:命名空间'google.maps'没有导出的成员'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>;
/**
依赖项:npm安装@ agm/corenpm i @ types/googlemaps
Dependencies: npm install @agm/core npm i @types/googlemaps
推荐答案
我发现,如果您使用的是 @ agm/core
,则其他一些答案中提到的解决方法也不起作用.更新到Angular 11时遇到了相同的错误.
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.
似乎Angular 11与 @ agm/core 3.0.0-beta.0
(最新版本)结合使用时无法正常工作.尝试将 @ agm/core
降级到以前的版本 1.1.0
.这对我有用.
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"
}
这篇关于命名空间"google.maps"没有导出的成员"MouseEvent"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!