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

174
Views
TypeError: undefined is not an object (evaluating 'ref.onSnapshot')

Angular and Firebase Firestore throws TypeError: undefined is not an object (evaluating 'ref.onSnapshot')

this.fbstore
      .collection(`claims`, ref => {
        let query:
          | firebase.default.firestore.CollectionReference
          | firebase.default.firestore.Query = ref;

          if(someValue === true) {
            return query.where('field1', '==', 20);
          }

          
      }).valueChanges();
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

The problem is if someValue is false then query is not returned, adding else statement will solve the issue or add default return query. These types of errors are time consuming if you rely on IDE, Typescript to much, it's easy to see the problem on this sample code.

this.fbstore
      .collection(`claims`, ref => {
        let query:
          | firebase.default.firestore.CollectionReference
          | firebase.default.firestore.Query = ref;

          if(someValue === true) {
            return query.where('field1', '==', 20);
          }
       
         return query; // this will not run if someValue is true

      }).valueChanges();
about 4 years ago · Juan Pablo Isaza Report
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!