Skip to content

Interface: RbacRegister ​

Defined in: packages/fastify/src/plugin.ts:34

Register your engine here to type request.rbac in every handler of the app:

ts
declare module '@anievo-id/rbac-evolution-fastify' {
  interface RbacRegister {
    rbac: typeof rbac // or the names type: AppRbac
  }
}

FastifyRequest is typed by module augmentation, which is global, so the engine passed to rbacPlugin can't flow there on its own. Without a registration, request.rbac is an untyped SubjectRbac.

Released under the MIT License. Inspired by spatie/laravel-permission.