Here is my CanActivate guard clause implementation in TypeScript. However, when I try to compile this code, I encounter the following error:
A function that does not return 'void' or 'any' must have a return value
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot):boolean {
this.appService.isValidUser().subscribe({
next: (data) => data.authenticated, // will return true or false
error: (err) => false
});
}
What might be causing this error?