@casl/angular@5.0.0
5.0.0 (2020-12-26)
Bug Fixes
Code Refactoring
- angular: removes support for Angular < 9.x and casl < 3.x (3530cdf)
Features
- builder: improves typings for AbilityBuilder [skip release] (ebd4d17), closes #379
- esm: adds ESM support for latest Node.js through
exportsprop in package.json (cac2506), closes #331
BREAKING CHANGES
-
angular: removes support for Angular < 9.x and casl < 3.x
-
builder: changes main generic parameter to be a class instead of instance and makes
defineAbilityto accept options as the 2nd argument.Before
import { AbilityBuilder, defineAbility, Ability } from '@casl/ability'; const resolveAction = (action: string) => {/* custom implementation */ }; const ability = defineAbility({ resolveAction }, (can) => can('read', 'Item')); const builder = new AbilityBuilder<Ability>(Ability);
After
import { AbilityBuilder, defineAbility, Ability } from '@casl/ability'; const resolveAction = (action: string) => {/* custom implementation */ }; const ability = defineAbility((can) => can('read', 'Item'), { resolveAction }); const builder = new AbilityBuilder(Ability); // first argument is now mandatory!
The 1st parameter to
AbilityBuilderis now madatory. This allows to infer generic parameters from it and makes AbilityType that is built to be explicit.