-
Notifications
You must be signed in to change notification settings - Fork 43
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
Switch long bigint #333
Switch long bigint #333
Conversation
now v4 is using bigint
} | ||
|
||
/** DeploymentID stores owner and sequence number */ | ||
export interface DeploymentIDSDKType { | ||
owner: string; | ||
dseq: Long; | ||
dseq: bigint; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be BigInt
with caps included?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, I think bigint here is the way to use it as a basic type. For BigInt, it's more like a constructor for bigint. So for me I prefer bigint.
And also, In fact at the beginning I used BigInt here, but my local compiler told me when I was doing arithmetic operations using it with other bigint types:
The left-hand side of an arithmetic operation must be of type 'any', 'number', 'bigint' or an enum type. ts(2362)
Operator '*' cannot be applied to types 'BigInt' and 'bigint'. ts(2365)
So that's also why I changed it into bigint.
@@ -177,7 +177,7 @@ export const Group = { | |||
message.groupId = object.groupId !== undefined && object.groupId !== null ? GroupID.fromPartial(object.groupId) : undefined; | |||
message.state = object.state ?? 0; | |||
message.groupSpec = object.groupSpec !== undefined && object.groupSpec !== null ? GroupSpec.fromPartial(object.groupSpec) : undefined; | |||
message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? Long.fromValue(object.createdAt) : Long.ZERO; | |||
message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? (prop => BigInt(prop.toString!!()))(object.createdAt) : BigInt("0"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the idea behind using an executed anonymous function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah... I just thought it as a bigint version of Long.fromValue (without applying toString to the property itself). After thinking this again, i'll change it to a decent way of doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done removing.
add a flag to switch Long or bigint
handle all cases switching between Long or bigint
also to switch helper.ts between Long or bigint