title: BehaviorSubject next not defined
body: <p>I am getting runtime error when i set next(..) on a BehaviorSubject that is a firebase.User | null type.</p>
  
  <pre><code>subscribe.js:165 TypeError: Cannot read property 'next' of undefined
  </code></pre>
  
  <p>Here is the code thats causing the issue.</p>
  
  <pre><code>export class AppAuthService {
  
     private currentUserSubject = new BehaviorSubject&lt;firebase.User |null&gt;(null);
     public currentUser = this.currentUserSubject.asObservable().distinctUntilChanged();
  
     private isAuthenticatedSubject = new ReplaySubject&lt;boolean&gt;(1);
     public isAuthenticated = this.isAuthenticatedSubject.asObservable();
  
     constructor(public afAuth: AngularFireAuth) {
        afAuth.auth.onAuthStateChanged(this.onAuthStateChanged);
      }
  
      onAuthStateChanged(user: firebase.User): void {
        if (user) {
          this.currentUserSubject.next(user);    &lt;------err
          this.isAuthenticatedSubject.next(true);
          console.log('loggedIN!');
        } else {
          this.currentUserSubject.next(null);   &lt;-------err
          this.isAuthenticatedSubject.next(false);
          console.log('GONE!');
        }
     }
  
  }
  </code></pre>
  
  <p>The error shows up anytime when <code>this.currentUserSubject.next(..)</code> is set to a user obj or null. I suspect its because the currentUserSubject is initialized with null and next of null is wrong?... </p>
  
  <pre><code>private currentUserSubject = new BehaviorSubject&lt;firebase.User |null&gt;(null);
  </code></pre>
  
  <p>I am not able to initialize it with <code>new firebase.User()</code> because its an interface and not an object.</p>
  
  <p>Also declaring currentUserSubject as subject results in same error.</p>
  
  <pre><code>private currentUserSubject = new Subject(); 
  </code></pre>
  
  <p>What is the best way to convert the firebase.User interface into a Subject/ReplaySubject? I am trying to do this so that when user changes something on profile component it will dynamic update on firebase server.</p>
  
  <p>Thanks.</p>