title: rxjs6 - TypeError: Cannot read property 'pipe' of undefined
body: <p>After migrating from RxJs 5 beta version to RxJs 6 getting below error - </p>
  
  <p><strong>ERROR TypeError: Cannot read property 'pipe' of undefined
      at Object.get [as selectedTimecard]</strong></p>
  
  <p>This is my latest code after migration</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>import {
    combineLatest as observableCombineLatest,
    Subscription,
    Observable
  } from 'rxjs';
  
  import {
    filter,
    take
  } from 'rxjs/operators';
  
  import Timecard from './../models/timecard';
  import * as fromRoot from '../reducers';
  
  @Component({
    selector: 'gte-timecards-overview-page',
    changeDetection: ChangeDetectionStrategy.OnPush,
    template: `
     &lt;gte-timecard-week
      *ngIf="(hasTimecards$ | async) &amp;&amp; !! (selectedTimecard$ | async)"
      [timecard]="selectedTimecard$ | async"
      [editable]="true"
      [hasPictureBackground]="true"
      [user]="user$ | async"
      (onCreateNewEntry)="createEntry($event)"
      (onEdit)="editEntry($event)"
      (onUpdateDay)="updateDay($event)"
      (onDeleteEntry)="deleteEntry($event)"
      (onCopyEntry)="copyEntry($event)"&gt;
     &lt;/gte-timecard-week&gt;
      `,
  })
  export class TimecardsOverviewPageComponent {
    @ViewChild('footerActions') footerActions;
    // User state
    user$: Observable &lt; User &gt; ;
  
    // Timecards state
    selectedTimecard$: Observable &lt; Timecard &gt; ;
    rawSelectedTimecard$: Observable &lt; Timecard &gt; ;
  
    routerSubscription: Subscription;
    requiresChangesCheck = true;
    selectedTimecardSate: string;
  
    constructor(private store: Store &lt; fromRoot.State &gt; , private router: Router, private translate: TranslateService) {
      this.user$ = store.select(fromRoot.getActiveUser);
      this.rawSelectedTimecard$ = store.select(fromRoot.getSelectedTimecard).pipe(filter(timecard =&gt; timecard !== null));
  
      // Add user depending fields to selected timecard
      this.selectedTimecard$ = Observable.combineLatest(this.user$, this.rawSelectedTimecard$, (user, timecard) =&gt; {
        if (!user || !timecard) {
          return;
        }
        let selected = null;
        if (!timecard.ID.includes('newTimecard')) {
          selected = timecard.clone();
          // Set user to selected timecard as owner
          selected.owner = user;
  
          // Set default settings for day settings
          let days = selected.days.map(day =&gt; {
            let newDay = day.clone();
            // TODO: set defaut values from API
            let defaultArrival = moment(day.date).set('hours', 9).set('minutes', 30);
            let defaultDeparture = moment(day.date).set('hours', 17).set('minutes', 50);
            let defaultBreakDuration = moment.duration(1, 'hours');
            let defaultBreakTaken = true;
  
            if (user.hasArrivalTimeSettings()) {
              newDay.arrivalTime = day.arrivalTime ? moment(day.arrivalTime) : defaultArrival;
              newDay.departureTime = day.departureTime ? moment(day.departureTime) : defaultDeparture;
              newDay.breakDuration = (day.breakDuration &amp;&amp; moment.isDuration(day.breakDuration)) ? day.breakDuration : defaultBreakDuration;
              newDay.breakTaken = null;
            } else if (user.hasBreakTakenSettings()) {
              newDay.arrivalTime = null;
              newDay.departureTime = null;
              newDay.breakDuration = null;
              newDay.breakTaken = day.breakTaken !== null ? day.breakTaken : defaultBreakTaken;
            } else {
              newDay.arrivalTime = null;
              newDay.departureTime = null;
              newDay.breakDuration = null;
              newDay.breakTaken = null;
            }
  
            return newDay;
          });
          selected.days = days;
        }
        return selected;
      });
    }
  
    saveTimecard() {
      let selectedTimecard = this.selectedTimecard;
      this.footerActions.submitCard = false;
      if (this.pastTimecard !== null &amp;&amp; this.footerActions.savePastTimecard) {
        this.footerActions.savePastTimecard = false;
        this.store.dispatch(new timecard.SaveAction(this.pastTimecard));
      } else {
        this.store.dispatch(new timecard.SaveAction(selectedTimecard));
      }
    }
  
    get selectedTimecard(): Timecard {
      let timecard: Timecard;
      console.log("selectedtcobs", this.selectedTimecard$)
      this.selectedTimecard$.pipe(take(1)).subscribe(selected =&gt; timecard = selected);
  
      return timecard;
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>In <code>selectedTimecard()</code>, <code>selectedTimecard$ objservable</code> is causing issue while using pipe/take operations.</p>
  
  <p>Please help us in resolving this issue.</p>