-
-
Notifications
You must be signed in to change notification settings - Fork 284
Open
Labels
Description
Describe the bug
The union type for Subject
appears to be incorrect when different subjcts have different actions.
To Reproduce
type Abilities = ["create" | "manage", "campaign"] | ["create" | "delete", "user:invite"]
const ability = createMongoAbility<Abilities>();
// Intellisense suggests this, but TS actually errors indicating this is incorrect (which it is)
ability.can('delete', 'campaign')
// This is correct
ability.can('delete', 'user:invite')
Expected behavior
The union type for subject should be impacted by the action, and not suggest subjects that are not valid for a given action.
CASL Version
@casl/ability
: 6.7.1