Is there a way to replace TS enum with something else for my needs? I specifically require the use of bigint in my enum for bitwise operations.
Here's an example of what I'm looking for:
enum Perms {
None = 0n,
Basic = 1n,
...
}
Then, I want to use it in a bitwise operation like this:
hasPermission(role: Role, permission: Perms): boolean {
return (role.permissions! & permission) !== 0;
}
Is it possible to define it as:
const Perms = {
None: BigInt(0),
Basic: BigInt(1),
...
}
However, I encounter an error in the hasPermission
method:
'Perms' refers to a value, but is being used as a type here. Did you mean 'typeof Perms'?