Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

393
Vistas
Property 'map' does not exist error when using Angular and Firebase

I am a beginner in angular and I try to communicate my app with firebase, using latest versions of angular and firebase

My Code:

export class ClientService {
  clientsCollection: AngularFirestoreCollection<Client>;
  clientDoc: AngularFirestoreDocument<Client>;
  clients: Observable<Client[]>
  client: Observable<Client>
  constructor(private afs: AngularFirestore) {
    this.clientsCollection = this.afs.collection<Client>('clients', ref => ref.orderBy('nom'))
  }
  getClients(): Observable<Client[]> {
    //Get id of clients
    this.clients = this.clientsCollection.snapshotChanges().map(changes => {
      return changes.map(action => {
        const data = action.payload.doc.data() as Client;
        const id = action.payload.doc.id;
        return { id, data }
      })
    })
    return this.clients;
  }
}

I get this error:

12   client: Observable<Client>
     ~~~~~~


Error: src/app/services/client.service.ts:18:61 - error TS2339: Property 'map' does not exist on type 'Observable<DocumentChangeAction<Client>[]>'.

18     this.clients = this.clientsCollection.snapshotChanges().map(changes => {
                                                               ~~~


Error: src/app/services/client.service.ts:18:65 - error TS7006: Parameter 'changes' implicitly has an 'any' type.

18     this.clients = this.clientsCollection.snapshotChanges().map(changes => {
                                                                   ~~~~~~~


Error: src/app/services/client.service.ts:19:26 - error TS7006: Parameter 'action' implicitly has an 'any' type.

19       return changes.map(action => {
                            ~~~~~~
× Failed to compile.
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda