0

I've just upgraded to Angular 4.1.1 From what i understand, AOT is now on by default(which is great).

I have a guard that don't use the next param.

If i try to run the code as is i get 'next' is declared but never used. error.

If i remove the 'next' param i get this error: Class 'AuthGuard' incorrectly implements interface 'CanActivate'.

This is the guard's code:

@Injectable()
export class AuthGuard implements CanActivate {
  constructor(private authService: AuthenticationService) {}
  canActivate(
    next: ActivatedRouteSnapshot,
    state: RouterStateSnapshot): Observable<boolean> | Promise<boolean> | boolean {
      return this.authService.guardCheck(state.url);
    }
}

What is the best way to handle this errors?

doron
  • 1,508
  • 3
  • 18
  • 27

1 Answers1

0

If anyone encounter this issue, just remove "noUnusedParameters": true, from tsconfig.ts

doron
  • 1,508
  • 3
  • 18
  • 27