title: RxJS 6+ Type 'Observable' must have a 'Symbol.iterator' method that returns an iterator
body: <p>Trying to get a filtered array of values from an observable I got the following error:</p>
  
  <blockquote>
    <p>Type 'Observable' must have a 'Symbol.iterator'
    method that returns an iterator.</p>
  </blockquote>
  
  <p>Code:</p>
  
  <pre><code>export class ItemsService {
  
    orderItems: OrderItem[] = [];
    orderItemsUrl = 'http://localhost:5000/order-items/';
  
    getOrderItemsFromHttp(selectedOrderNumber): Observable&lt;OrderItem[]&gt; {
      const tempArr = [];
        const orderItems = of (this.http.get&lt;OrderItem[]&gt;(`${this.orderItemsUrl}`)
        .subscribe(res =&gt; {
              this.orderItems = res;
        }) );
  
      for (const orderItem of orderItems) {                        &lt;--- Error here
          if (orderItem.orderNumber === selectedOrderNumber) {
            tempArr.push(orderItem);
          }
      }
      return of(tempArr);
    }  
  }
  </code></pre>
  
  <p>If I modify the following</p>
  
  <pre><code>for (const orderItem of orderItems) {
  </code></pre>
  
  <p>to </p>
  
  <pre><code>for (const orderItem of [orderItems]) {
  </code></pre>
  
  <p>error disappears but the property <strong>orderNumber</strong> is no more recignized, and the intellisens says:</p>
  
  <blockquote>
    <p>Property 'orderNumber' does not exist on type 'Subscription'</p>
  </blockquote>
  
  <p>So how can I fix it, please ?</p>