"Property 'heatLayer' does not exist on type [Leaflet]" on --prod build

Viewed 856

I'm trying to build my angular 9 project, using leaflet's heat map library. when compiling it works great, but when I try to --prod build it, I get the following error:

ERROR in heat-map-map.component.ts:112:7 - error TS2339: Property 'heatLayer' does not exist on type 'typeof import("projectPath/ClientApp/node_modules/@types/leaflet/index")'.

Here's my code:

var convertedData: [number, number, number][];

convertedData = this.grid.map(g => [g.lat, g.lon, this.data.find(d => d.toID == g.gid)?.time_sec]);

// THIS is the important line
L.heatLayer(convertedData, { max: max.time_sec }).addTo(this.markersLayer);
 
this.markersLayer.addTo(this.map);

and my imports:

import *  as L from 'leaflet'
import 'leaflet.heat/dist/leaflet-heat.js';

Thank you

0 Answers
Related