So I had this error with Typescript:
error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.
canActivate(activatedRouter: ActivatedRouteSnapshot, routerState: RouterStateSnapshot): boolean {
return this.checkAuthentication(activatedRouter.routeConfig.path);
}
You can fix this by specifying a possible empty object tin return:
canActivate(activatedRouter: ActivatedRouteSnapshot, routerState: RouterStateSnapshot): boolean {
return this.checkAuthentication(activatedRouter.routeConfig.path || '{}');
}