Below is my implementation of CanActivate guard clause in TypeScript , when I compile this code , it shows below error
A function whose declared type is neither 'void' nor 'any' must return a value
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):boolean {
this.appService.isValidUser().subscribe({
next: (data) => data.authenticated, // this return true or false
error: (err) => false
});
}
What is the reason for this error ?