diff --git a/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts b/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts index 7bd8bde9e14d7e..4a7297d5810efd 100644 --- a/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts +++ b/x-pack/legacy/plugins/maps/server/maps_telemetry/maps_telemetry.ts @@ -22,16 +22,23 @@ interface Stats { }; } -function getUniqueLayerCounts(layerCountsList: object[], mapsCount: number) { +interface ILayerTypeCount { + [key: string]: number; +} + +function getUniqueLayerCounts(layerCountsList: ILayerTypeCount[], mapsCount: number) { const uniqueLayerTypes = _.uniq(_.flatten(layerCountsList.map(lTypes => Object.keys(lTypes)))); return uniqueLayerTypes.reduce((accu: Stats, type: string) => { - const typeCounts = layerCountsList.reduce((tCountsAccu: number[], tCounts: any) => { - if (tCounts[type]) { - tCountsAccu.push(tCounts[type]); - } - return tCountsAccu; - }, []); + const typeCounts = layerCountsList.reduce( + (tCountsAccu: number[], tCounts: ILayerTypeCount): number[] => { + if (tCounts[type]) { + tCountsAccu.push(tCounts[type]); + } + return tCountsAccu; + }, + [] + ); const typeCountsSum = _.sum(typeCounts); accu[type] = { min: typeCounts.length ? _.min(typeCounts) : 0,