protobuf.js
protobuf.js copied to clipboard
int64 precesion problem
protobuf.js version: 7.2.1 The int64 field is of wrong value. It seems it doesn't use Long type. I print the value and find it wrong. And also the type is number not Long.
this.message = ServerRefreshInventoryList.decode(message);
let serverRefreshInventoryList = (<ServerRefreshInventoryList>value.message);
console.log(typeof serverRefreshInventoryList.inventories.at(0)!.id)
let str = "";
for (let inventory of serverRefreshInventoryList.inventories) {
str += inventory.id!.toString() + ",";
}
console.log(str);
message ServerRefreshInventory {
int64 id = 1;
int64 itemId = 2;
}
message ServerRefreshInventoryList {
repeated ServerRefreshInventory inventories = 1;
}
This is generated.
interface IServerRefreshInventory {
/** ServerRefreshInventory id */
id?: (number|Long|null);
/** ServerRefreshInventory itemId */
itemId?: (number|Long|null);
}
This is the wrong ids.
32945611418370056,32945611418370056,32945611439341570,32945611418370050,32945611464507396,32945611464507400,32945611472896004,32945611460313092,32945611443535876,32945611439341572,32945611464507390,32945611468701696,32945611451924490,32945611472896004,32945611456118784,32945611464507390,32945611451924490,32945611472896000,32945611468701700,32945611468701700,32945611426758660,32945611443535876,32945611456118788,32945611426758660,32945611439341572,32945611443535870,32945611468701704,32945611426758656,32945611464507396,32945611468701696,32945611418370060,32945611468701704,32945611460313092,32945611409981440,32945611439341576,32945611422564356,32945611460313100,32945611439341572,32945611464507396,32945611460313096,32945611464507400,32945611460313100,32945611422564350,32945611460313096,32945611422564356,32945611372232704,32945611447730184,32945611439341576,32945611451924480,32945611451924480,32945611456118784,32945611468701696,32945611447730180,32945611451924484,32945611443535870,32945611460313090,32945611451924480,32945611426758660,32945611447730180,32945611456118788,32945611443535876,32945611443535880,32945611464507390,32945611426758664,32945611439341570,32945611430952960,32945611418370056,32945611435147268,32945611418370052,32945611447730176,32945611430952960,32945611460313090,32945611426758664,32945611439341570,32945611464507400,32945611460313092,32945611460313100,32945611447730176,32945611477090304,32945611464507400,32945611418370050,32945611418370052,32945611435147268,32945611447730180,32945611418370056,32945611422564350,32945611472896000,32945611418370050,32945611418370052,32945611477090304,32945611451924484,32945611418370056,32945611422564350,32945611468701704,32945611435147268,32945611460313096,32945611430952960,32945611435147264,32945611426758656,32945611435147264,32945611435147264,32945611460313090,32945611409981440,32945611435147270,32945611447730176,32945611477090304,32945611443535870,32945611414175744,32945611468701700,32945611460313096,32945611472896000,32945611451924484,32945611477090308,32945611460313096,32945611426758656,32945611414175744,32945611435147270,32945611451924490,32945611422564356,32945611456118784,
This is the correct ids.
32945611443535873,32945611426758662,32945611435147266,32945611468701703,32945611456118784,32945611447730182,32945611460313100,32945611468701699,32945611468701696,32945611418370055,32945611460313095,32945611460313099,32945611439341575,32945611426758656,32945611422564357,32945611451924482,32945611430952962,32945611414175745,32945611447730180,32945611460313096,32945611464507400,32945611477090307,32945611418370052,32945611468701698,32945611418370049,32945611418370058,32945611468701702,32945611460313088,32945611422564354,32945611460313097,32945611472896001,32945611418370057,32945611430952960,32945611451924488,32945611447730177,32945611435147270,32945611422564355,32945611435147265,32945611451924484,32945611468701701,32945611430952961,32945611464507395,32945611460313091,32945611451924486,32945611451924480,32945611418370050,32945611439341569,32945611451924487,32945611472896000,32945611456118787,32945611460313098,32945611464507397,32945611435147271,32945611472896002,32945611426758661,32945611418370056,32945611464507394,32945611409981440,32945611443535876,32945611451924483,32945611447730176,32945611426758657,32945611435147267,32945611477090306,32945611418370054,32945611443535878,32945611439341573,32945611472896003,32945611418370053,32945611435147269,32945611443535874,32945611422564352,32945611464507401,32945611447730179,32945611426758659,32945611435147264,32945611451924481,32945611460313093,32945611456118788,32945611439341571,32945611468701700,32945611477090304,32945611460313089,32945611464507398,32945611418370059,32945611464507399,32945611460313094,32945611464507393,32945611472896004,32945611447730181,32945611435147268,32945611439341570,32945611439341572,32945611439341568,32945611460313101,32945611443535875,32945611468701704,32945611443535877,32945611372232704,32945611456118785,32945611477090305,32945611460313092,32945611414175744,32945611422564353,32945611426758663,32945611426758660,32945611443535872,32945611439341574,32945611418370048,32945611422564356,32945611409981441,32945611418370051,32945611456118786,32945611447730178,32945611451924485,32945611464507396,32945611464507392,32945611426758658,32945611460313090,32945611468701697,