From 698a8b11add5891096bda5d68495352b7b544466 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Tue, 2 Jun 2026 13:36:51 +1000 Subject: [PATCH] fix(google-maps): repair heatmap layer types and deprecate component @types/google.maps v3.65 removed HeatmapLayer/HeatmapLayerOptions (Google's deprecation, runtime gone May 2026), breaking typecheck. Type the layer surface locally so it compiles, and flag the component as deprecated via a dev warning and @deprecated JSDoc pointing to deck.gl. --- .../ScriptGoogleMapsHeatmapLayer.vue | 37 +++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue b/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue index a6d8b6aab..8cbcebe5e 100644 --- a/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue +++ b/packages/script/src/runtime/components/GoogleMaps/ScriptGoogleMapsHeatmapLayer.vue @@ -5,15 +5,46 @@ import { useGoogleMapsResource } from './useGoogleMapsResource' const props = defineProps<{ /** * Configuration options for the heatmap layer visualization. + * @deprecated Google deprecated the Maps JavaScript API `HeatmapLayer` (May 2025) and removed it in v3.65 (May 2026). Consider [deck.gl HeatmapLayer](https://deck.gl/docs/api-reference/aggregation-layers/heatmap-layer) instead. * @see https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions */ - options?: Omit + options?: Omit }>() -const heatmapLayer = useGoogleMapsResource({ +if (import.meta.dev) { + console.warn( + '[nuxt-scripts] is deprecated. ' + + 'Google deprecated the Maps JavaScript API HeatmapLayer (May 2025) and removed it in v3.65 (May 2026). ' + + 'Consider deck.gl HeatmapLayer instead: https://deck.gl/docs/api-reference/aggregation-layers/heatmap-layer', + ) +} + +/** + * Configuration options for the heatmap layer visualization. + * + * The `HeatmapLayer` types were removed from `@types/google.maps` in v3.65 as part of Google's + * deprecation (the runtime feature is still available until May 2026), so we type the surface locally. + * @see https://developers.google.com/maps/documentation/javascript/reference/visualization#HeatmapLayerOptions + */ +interface HeatmapLayerOptions { + data?: unknown + dissipating?: boolean + gradient?: string[] + map?: google.maps.Map + maxIntensity?: number + opacity?: number + radius?: number +} +interface HeatmapLayer { + setMap: (map: google.maps.Map | null) => void + setOptions: (options: HeatmapLayerOptions) => void +} + +const heatmapLayer = useGoogleMapsResource({ async create({ mapsApi, map }) { await mapsApi.importLibrary('visualization') - return new mapsApi.visualization.HeatmapLayer({ + const Layer = mapsApi.visualization.HeatmapLayer as unknown as new (opts: HeatmapLayerOptions) => HeatmapLayer + return new Layer({ map, ...props.options, })