diff --git a/webapp/src/ts/directives/auth.directive.ts b/webapp/src/ts/directives/auth.directive.ts index 339f4dbf326..df139f7506d 100644 --- a/webapp/src/ts/directives/auth.directive.ts +++ b/webapp/src/ts/directives/auth.directive.ts @@ -2,12 +2,27 @@ import * as _ from 'lodash-es'; import { Directive, Input, HostBinding, OnChanges } from '@angular/core'; import { AuthService } from '../services/auth.service'; +/** + * A single property accepted by `mmAuthAny`. Reflects the runtime branches + * in the directive's `dynamicChecks`: + * - `true` -> short-circuit allow (line: mmAuthAny.some(p => p === true)) + * - string -> a single permission name + * - string[] -> an AND-group of permission names (flattened via _.flattenDeep) + */ +type AuthAnyValue = boolean | string | string[]; + +/** + * `mmAuthAny` accepts either a single AuthAnyValue (auto-wrapped to a one-element array + * at runtime) or an array of them representing OR-of-AND-groups. + */ +type AuthAnyInput = AuthAnyValue | AuthAnyValue[]; + @Directive({ selector: '[mmAuth]' }) export class AuthDirective implements OnChanges { @Input() mmAuth?: string; - @Input() mmAuthAny?: any; + @Input() mmAuthAny?: AuthAnyInput; @Input() mmAuthOnline?: boolean; private hidden = true; diff --git a/webapp/src/ts/training-card.guard.provider.ts b/webapp/src/ts/training-card.guard.provider.ts index edd612acd5e..93de3276c8a 100644 --- a/webapp/src/ts/training-card.guard.provider.ts +++ b/webapp/src/ts/training-card.guard.provider.ts @@ -9,7 +9,7 @@ import { Selectors } from '@mm-selectors/index'; @Injectable({ providedIn: 'root' }) -export class TrainingCardDeactivationGuardProvider implements CanDeactivate { +export class TrainingCardDeactivationGuardProvider implements CanDeactivate { private readonly globalActions: GlobalActions; constructor(private readonly store: Store) { @@ -17,7 +17,7 @@ export class TrainingCardDeactivationGuardProvider implements CanDeactivate } canDeactivate( - component: any, + component: unknown, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot,