fix: handle edge object in serialization tests

Add `typecheck` script to package.json, expand tsconfig include
paths to cover tests and examples, and update serialization tests
to correctly resolve player IDs from relationship edges.
This commit is contained in:
hypercross 2026-06-02 18:05:47 +08:00
parent cd6350e0b1
commit 365b2c4d13
3 changed files with 6 additions and 4 deletions

View File

@ -29,6 +29,7 @@
"scripts": { "scripts": {
"build": "tsup", "build": "tsup",
"dev": "tsup --watch", "dev": "tsup --watch",
"typecheck": "tsc --noEmit",
"test": "vitest run", "test": "vitest run",
"prepublishOnly": "npm run build" "prepublishOnly": "npm run build"
}, },

View File

@ -277,7 +277,9 @@ describe("Serialization — complex state", () => {
const comps = snap.entities[id]; const comps = snap.entities[id];
return comps.position && comps.velocity && !comps.health; return comps.position && comps.velocity && !comps.health;
})!; })!;
const playerId = snap.relationships.ownedBy[bulletId]; const playerEdge = snap.relationships.ownedBy[bulletId];
const playerId =
typeof playerEdge === "string" ? playerEdge : playerEdge.target;
// Player should have a name // Player should have a name
const playerComps = snap.entities[playerId]; const playerComps = snap.entities[playerId];

View File

@ -11,8 +11,7 @@
"declarationMap": true, "declarationMap": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",
"rootDir": "./src"
}, },
"include": ["src"], "include": ["src", "test", "examples"],
"exclude": ["node_modules", "dist"] "exclude": ["node_modules", "dist"],
} }