title: Error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value
body: <p>I'm using an auth guard in angular 5 to check if the user should be able to navigate to a specific page. I am getting an error related to returning an observable:</p>
  
  <p><strong>A function whose declared type is neither 'void' nor 'any' must return a value.</strong></p>
  
  <p>This is my authguard.ts </p>
  
  <p>import { Injectable } from '@angular/core';
  import { Router, CanActivate, ActivatedRoute, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
  import { ApplicationVerificationService } from '../../service/application-verification.service';</p>
  
  <pre><code>@Injectable() export class AppStatusGuard implements CanActivate {
  
    applicationId: number;   personId: number;
  
    constructor(
      public router: Router,
      public readonly activeRoute: ActivatedRoute,
      public readonly applicationVerificationService: ApplicationVerificationService) { }
  
    loginRoute: boolean;   memberRoute: boolean;
  
  
    canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
  
      this.applicationId = Number(route.params["applicationId"]);
      this.personId = Number(route.params["personId"]);
  
      // Make sure they are allowed on this page, if not re-direct
      const url = this.applicationVerificationService.getRouteForFellowshipApplicant(this.personId, this.applicationId)
        .subscribe((res: string) =&gt; {
          console.log(url);
  
          if (res !== `application-status/${this.personId}/${this.applicationId}`) {
            console.log("failure");
            // this.router.navigateByUrl(url);
            return false;
          } else {
            console.log("success");
            //this.router.navigateByUrl(url);
            return true;
          }
        });   
    }; 
  };
  </code></pre>
  
  <p>This is my verification service</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { HttpClient } from '@angular/common/http';
  import { Router } from '@angular/router';
  import 'rxjs/Rx';
  import { Observable } from 'rxjs/Observable';
  
  @Injectable()
  export class ApplicationVerificationService {
    constructor(
      private readonly httpClient: HttpClient,
      private readonly router: Router) { }
  
    getRouteForFellowshipApplicant(personId, applicationId): Observable&lt;string&gt; {
      this.httpClient.get('api/application-verification/' + personId).subscribe((responseObject: IFellowshipApplicationStatus) =&gt; {
  
        return Observable.create(observer =&gt; {
  
          if (responseObject.preApplicationVerificationStatus === 'GoToTrackerPage') {
            observer.next('application-status/' + personId + '/' + applicationId);
          }
          if (responseObject.preApplicationVerificationStatus === 'GoToApplicationFormPage') {
            observer.next('application-form/' + personId + '/' + applicationId);
          }
          if (responseObject.preApplicationVerificationStatus === 'GoToContactIceForInfoPage') {
            observer.next('contact-us/' + personId + '/' + applicationId);
          }
          if (responseObject.preApplicationVerificationStatus === 'GenericError') {
            observer.next('application-error/' + personId);
          }
          observer.complete();
        });
      });
      return null;
    }
  }
  </code></pre>
  
  <p>I'm new to rxjs and I think I've made an error with how I am returning observable but I'm struggling a bit. Any help would be appreciated.</p>