stalniy / casl

CASL is an isomorphic authorization JavaScript library which restricts what resources a given user is allowed to access
https://casl.js.org/
MIT License
6.05k stars 270 forks source link

feat: update accessibleBy function of casl/prisma to autocomplete action names #965

Open zunkelty opened 2 months ago

zunkelty commented 2 months ago

When using the accessibleBy function of casl/prisma, the action names property is not autocompleted in Typescript although it could be inferred.

e.g. in this case update would not be autocompleted which could result in issues and causes a degraded DX.

accessibleBy(ability, 'update')

This PR infers the possible actions from the ability passed as the first parameter.