-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript definition for clearFlags and setFlags don't allow bitwise operations. #347
Comments
Hello, this issue caught my eye as i had some problems with eslints bitwise in another place so i got looking to see what would cause it. Well it seems you can't use a bitmap value with typescript or at least i couldn't figure out how. so first i made a list of what the other numbers that are valid inputs would be, however keep in mind there would be other places these types are used that would also need to be updated. it seems there should some way to do this.
Or maybe something like this (but this might not work in a d.ts file) export enum AuthFlags {
AuthRequiredFlag = 0x1,
AuthRevocableFlag = 0x2,
AuthImmutableFlag = 0x4,
AuthClawbackEnabledFlag = 0x8,
}
export type AuthFlag = {
[P in keyof typeof AuthFlags]?: boolean;
};```
I'm not sure the best way to solve it but i found this an amusing diversion. |
You can use bitwise operation to turn on multiple flags in the same transaction, however, TypeScript complains that the value isn't valid, since it's expecting the value to be either 1,2, or 4.
It's very likely other fields with bitwise support have the same issue.
The text was updated successfully, but these errors were encountered: