Skip to content

Function: isPermissionName() ​

ts
function isPermissionName<T, G>(
   rbac, 
   value, 
   options?
): value is PermissionName<T, G>;

Defined in: packages/core/src/names.ts:132

true if value is one of the permission names listed in createRbac({ names: { permissions } }), and narrows it to the engine's PermissionName<T>. Same rules as isRoleName: exact names from the list, no database query, a TypeError if the engine has no names.permissions, and { guard } for per-guard lists.

Type Parameters ​

Type ParameterDefault type
T extends RbacTypeConfig-
G extends stringDefaultGuardName<T>

Parameters ​

ParameterType
rbacRbac<T>
valueunknown
options?GuardOptions<CheckGuard<T, G>>

Returns ​

value is PermissionName<T, G>

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