Attempt to fix bigint serialization issue (#1501)

## Description:

Attempt to fix bigint serialization issue

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [ ] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [ ] I have read and accepted the CLA aggreement (only required once).
This commit is contained in:
Scott Anderson
2025-07-19 21:35:57 -04:00
committed by GitHub
parent 11e92246f2
commit 123787e299
4 changed files with 18 additions and 12 deletions
+1
View File
@@ -450,6 +450,7 @@ export const ServerDesyncSchema = z.object({
export const ServerErrorSchema = z.object({
type: z.literal("error"),
error: z.string(),
message: z.string().optional(),
});
export const ServerMessageSchema = z.discriminatedUnion("type", [
+1 -1
View File
@@ -89,7 +89,7 @@ export const OTHER_INDEX_LOST = 3; // Structures/warships destroyed/captured by
export const OTHER_INDEX_UPGRADE = 4; // Structures upgraded
const BigIntStringSchema = z.preprocess((val) => {
if (typeof val === "string" && /^\d+$/.test(val)) return BigInt(val);
if (typeof val === "string" && /^-?\d+$/.test(val)) return BigInt(val);
if (typeof val === "bigint") return val;
return val;
}, z.bigint());