Quería usar Set Type, porque pensé que no podía tener el mismo valor dos veces. Pero mi conjunto 'coords' obtiene el mismo valor más de una vez. ¿Qué puedo hacer para obtener solo valores únicos?
ngOnInit(): void { this.coords = new Set<Coordinate>(); this.coordinatesService.coordinates.subscribe((coordinates: Coordinate[]) => { coordinates.forEach((coordinate) => { this.addMarker(coordinate); }); }); } addMarker(coordinate: Coordinate): void { if (!this.coords.has(coordinate)) { this.coords.add(coordinate); L.marker([coordinate.latitude, coordinate.longitude], this.icon) .bindPopup('<b>Found location</b><br>' + coordinate.label) .addTo(this.citiesLayerGroup); } }En el Servicio agregué una Interfaz.
export interface Coordinate { latitude: number; longitude: number; label: string; }