“SuperClusterViewportOptions”类型上不存在属性“radius”

问题描述 投票:0回答:1

我在我的项目中使用markerclusterer,但我确实收到以下错误

Error: node_modules/@googlemaps/markerclusterer/dist/algorithms/superviewport.d.ts:37:28 - error TS2339: Property 'radius' does not exist on type 'SuperClusterViewportOptions'.

37     constructor({ maxZoom, radius, viewportPadding, ...options }: SuperClusterViewportOptions);

依赖关系

index.html

<script
  src="https://unpkg.com/@googlemaps/markerclustererplus/dist/index.min.js" async defer
></script>

package.json

"devDependencies": {
  "@types/google.maps": "3.54.3"
},
"peerDependencies": {
  "@angular/common": ">=16.0.3",
  "@angular/core": ">=16.0.3",
  "@angular/google-maps": ">=16.0.1",
  "@angular/material": ">=16.0.1",
  "@googlemaps/js-api-loader": "1.16.2",
  "@googlemaps/markerclusterer": "2.5.1", // <-- markerclusterer
  "@megaphone/bases": ">=5.9.10",
  "@megaphone/pipes": ">=5.9.6",
  "@megaphone/geolocation": ">=5.9.2"
},

有人有解决办法吗?

angular google-maps markerclusterer
1个回答
0
投票
  1. 运行:
    npm i --save-dev @types/supercluster @types/google.maps
  2. 如果您使用 Angular,您可能还需要将其添加到
    angularCompilerOptions
    文件中
    tsconfig.json
    键的值中:
"angularCompilerOptions": {
    ...
    "allowSyntheticDefaultImports": true
    ...
}

谢谢 gregorgabrovsek:回复

© www.soinside.com 2019 - 2024. All rights reserved.