title: Why am I obtaining these two errors trying to subscrive an Angular service method that retrieve data from Firestore database?
body: <p>I am following a course related to Angular and Firestore database and I have the following two problem:</p>
  
  <p>In a controller class I have this <strong>ngOnInit()</strong> method:</p>
  
  <p>ngOnInit() {</p>
  
  <pre><code>this.course = this.route.snapshot.data['course'];
  this.lessons = this.coursesService.findLessons(this.course.id)
      .subscribe(
        lessons =&gt; this.lessons = lessons
      );
  </code></pre>
  
  <p>}</p>
  
  <p>As you can see I am subscribing on the <strong>coursesService.findLessons()</strong> method, and this is the code of this service method:</p>
  
  <p>findLessons(courseIs: string,
                sortOrder: OrderByDirection = 'asc',
                pageNumber = 0,
                pageSize = 3): Observable {</p>
  
  <pre><code>return this.db.collection('courses/${courseId}/lessons',
              ref =&gt; ref.orderBy('seqNo', sortOrder)
              .limit(pageSize)
              .startAfter(pageNumber * pageSize))
              .snapshotChanges()
              .pipe(
                map(snaps =&gt; convertSnaps&lt;Lesson&gt;(snaps)),
                first()
              )
  </code></pre>
  
  <p>}</p>
  
  <p>On this service method Visual Studio Code give me an error on this line:</p>
  
  <pre><code>sortOrder: OrderByDirection = 'asc',
  </code></pre>
  
  <p>the error says:</p>
  
  <blockquote>
    <p>Cannot find name 'OrderByDirection'.ts(2304)</p>
  </blockquote>
  
  <p>On the call of this service method into my controller <strong>ngOnInit()</strong> method give me an error on the <strong>this.lessons</strong> (that is previously defined as <strong>lessons: Lesson[];</strong></p>
  
  <pre><code>Type 'Subscription' is missing the following properties from type 'Lesson[]': length, pop, push, concat, and 26 more.ts(2740)
  </code></pre>
  
  <p>What exactly means? Why am I obtaining this error? What am I missing? How can I try to fix it?</p>