Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

386
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!