diff --git a/types/leaflet.heat/index.d.ts b/types/leaflet.heat/index.d.ts index 66464fcb08..f294080691 100644 --- a/types/leaflet.heat/index.d.ts +++ b/types/leaflet.heat/index.d.ts @@ -1,12 +1,12 @@ -// Type definitions for Leaflet.heat v0.2.0 +// Type definitions for Leaflet.heat 0.2 // Project: https://github.com/Leaflet/Leaflet.heat // Definitions by: Önder Ceylan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -/// +import * as L from 'leaflet'; -declare namespace L { +declare module 'leaflet' { type HeatLatLngTuple = [number, number, number]; interface ColorGradientConfig { @@ -26,6 +26,7 @@ declare namespace L { setOptions(options: HeatMapOptions): HeatLayer; addLatLng(latlng: LatLng | HeatLatLngTuple): HeatLayer; setLatLngs(latlngs: Array): HeatLayer; + redraw(): TileLayer; } function heatLayer(latlngs: Array, options: HeatMapOptions): HeatLayer; diff --git a/types/leaflet.heat/leaflet.heat-tests.ts b/types/leaflet.heat/leaflet.heat-tests.ts index aead8f1960..cbad005d8d 100644 --- a/types/leaflet.heat/leaflet.heat-tests.ts +++ b/types/leaflet.heat/leaflet.heat-tests.ts @@ -1,11 +1,14 @@ -const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', - osmAttrib = '© OpenStreetMap contributors', - osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}), - map = new L.Map('map', { - layers: [osm], - center: new L.LatLng(50.5, 30.5), - zoom: 15, - }); +import * as L from 'leaflet'; +import 'leaflet.heat'; + +const osmUrl = 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'; +const osmAttrib = '© OpenStreetMap contributors'; +const osm = L.tileLayer(osmUrl, {maxZoom: 18, attribution: osmAttrib}); +const map = new L.Map('map', { + layers: [osm], + center: new L.LatLng(50.5, 30.5), + zoom: 15, +}); // Each point in the input array can be either an array like [50.5, 30.5, 0.5], or a Leaflet LatLng object. const heat: L.HeatLayer = L.heatLayer([