Skip to content

(feat) Allow number as valid role and grant type (fixes #93)#94

Closed
vegerot wants to merge 13 commits into
onury:masterfrom
vegerot:valid_number_role
Closed

(feat) Allow number as valid role and grant type (fixes #93)#94
vegerot wants to merge 13 commits into
onury:masterfrom
vegerot:valid_number_role

Conversation

@vegerot

@vegerot vegerot commented Nov 20, 2020

Copy link
Copy Markdown

In some cases it makes sense to have numbers instead of strings for
role types. For example, when using enums in TypeScript

Fixes #93

In some cases it makes sense to have `number`s instead of `string`s for
role types.  For example, when using `enum`s in TypeScript

Fixes onury#93
@coveralls

coveralls commented Nov 20, 2020

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.04%) to 96.907% when pulling 0b40633 on vegerot:valid_number_role into c91eb67 on onury:master.

@onury
onury force-pushed the master branch 2 times, most recently from 260e67d to eb9deac Compare June 24, 2026 01:41
@onury

onury commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Sorry for the very late reply @vegerot. v3.0.0 just shipped — a ground-up rewrite — so this no longer applies to the current codebase.

v3 keeps roles (and resources/actions) as string by design; it keeps the grants object, events, and serialization consistent. For TS enums, string enums work directly (ac.grant(Role.Admin)), and numeric enums just need a stringify at the call site (ac.grant(String(Role.Admin))).

Closing in favor of v3.

@onury onury closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow number as valid type of role

3 participants