Skip to content

Commit

Permalink
Update permission interface in order to correctly type abilities.
Browse files Browse the repository at this point in the history
  • Loading branch information
Triskae committed Dec 19, 2024
1 parent 7115394 commit 299d43b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/interfaces/permissions.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Ability, AnyAbility, AbilityTuple, AbilityBuilder, Subject } from '@casl/ability';
import { AbilityBuilder, AbilityTuple, MongoAbility, Subject } from '@casl/ability';
import { AnyClass } from '@casl/ability/dist/types/types';
import { DefaultActions } from '../actions.enum';
import { AuthorizableUser } from './authorizable-user.interface';
Expand All @@ -7,11 +7,11 @@ export class UserAbilityBuilder<
Subjects extends Subject = Subject,
Actions extends string = DefaultActions,
User extends AuthorizableUser<unknown, unknown> = AuthorizableUser,
> extends AbilityBuilder<AnyAbility> {
> extends AbilityBuilder<MongoAbility<AbilityTuple<Actions, Subjects>>> {
constructor(
public user: User,
public permissions: AnyPermissions<string, Subjects, Actions, User>,
AbilityType: AnyClass<Ability<AbilityTuple<Actions, Subjects>>>,
AbilityType: AnyClass<MongoAbility<AbilityTuple<Actions, Subjects>>>,
) {
super(AbilityType);
}
Expand Down

0 comments on commit 299d43b

Please sign in to comment.