export interface Marker { id: string lat: number lng: number color: string name: string description: string icon: string radius: number } export type Map = { [id: string]: Marker } export function toMap(markers: Array): Map { let res: Map = {} markers.forEach(marker => res[marker.id] = marker) return res }