You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When importing json-bigint-patch, the ability check in CASL fails to correctly match conditions using BigInt. Specifically, ability.can() incorrectly returns false when it should return true.
To Reproduce
Steps to reproduce the behavior:
Ability configuration:
import'json-bigint-patch';import{createMongoAbility,subject}from'@casl/ability';classArticle{id: bigint;}typeActions='all';typeSubjects=Article|typeofArticle|'Article';constability=createMongoAbility<[Actions,Subjects]>([{action: 'all',subject: 'Article',conditions: {id: 5n},},{action: 'all',subject: 'Article',conditions: {id: 1n},},]);constarticle=newArticle();article.id=1n;console.log(ability.can('all',subject('Article',article)));// returns false, but it should return true
How abilities are checked:
Using ability.can() with a condition that should match, but it fails when json-bigint-patch is imported.
Expected behavior
When json-bigint-patch is imported, ability.can() should return true for matching conditions, just as it does without the import.
CASL Version
@casl/ability - v6.7.3
Environment:
Node.js: v22.12.0
TypeScript: v5.7.2
json-bigint-patch: v0.0.8
The text was updated successfully, but these errors were encountered:
json-bigint-patch adds custom toJSON method. Ucsst expects toJSON to return primitive value, but in that patch lib it returns non primitive. I think it actually returns BigInt objectified instance. I’ll double check tomorrow
Describe the bug
When importing json-bigint-patch, the ability check in CASL fails to correctly match conditions using BigInt. Specifically, ability.can() incorrectly returns false when it should return true.
To Reproduce
Steps to reproduce the behavior:
Using ability.can() with a condition that should match, but it fails when json-bigint-patch is imported.
Expected behavior
When json-bigint-patch is imported, ability.can() should return true for matching conditions, just as it does without the import.
CASL Version
@casl/ability
- v6.7.3Environment:
The text was updated successfully, but these errors were encountered: