0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Debug Type Check (#1046)

This updates the debug command to type check before executing the run
entry. If the check fails the debug will not continue.

This unfortunately breaks the TSX `watch` function and the debugger now
has to be manually restarted when code is changed. I've been unable to
find a solution to this.

While not ideal, an alternative is to only type-check on build and leave
debug using TSX directly, like we were. Let me know if you'd rather go
that way and get your `watch` back.

----------------

Also includes possible fixes (bbf56f7d23f729bcb12899b82f760d02abf60832)
for the two type errors that are currently holding back debug builds.

I say possible because
- I've only solved the issues with the current types and have no idea if
the types are actually correct
- Have only resolved the type errors within the IDE/TSC and have not
actually tested in game

They need to be reviewed.
This commit is contained in:
Chomp 2025-01-08 09:13:02 +00:00 committed by GitHub
commit 929efb714a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 14 additions and 7 deletions

View File

@ -30,11 +30,10 @@
{
"name": "Debug",
"type": "node",
"program": "${workspaceFolder}/src/entry/run.ts",
"runtimeVersion": "22.12.0",
"runtimeExecutable": "tsx",
"runtimeExecutable": "npm",
"request": "launch",
"runtimeArgs": ["watch", "--clear-screen=false"],
"runtimeArgs": ["run", "run:debug"],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"skipFiles": ["<node_internals>/**", "${workspaceFolder}/node_modules/**"]

View File

@ -14,7 +14,6 @@
"check:circular": "madge --circular --ts-config tsconfig.json --extensions ts ./src/",
"lint": "npx @biomejs/biome lint ./",
"lint:fix": "npx @biomejs/biome lint --write ./",
"lint:types": "tsc --noEmit",
"style": "npx @biomejs/biome format ./",
"style:fix": "npx @biomejs/biome format --write ./",
"format": "npx @biomejs/biome check --write ./",
@ -27,8 +26,9 @@
"build:bleeding": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleeding",
"build:bleedingmods": "cross-env PKG_CACHE_PATH=\"./.pkg-cache\" gulp build:bleedingmods",
"run:build": "gulp run:build",
"run:debug": "tsx ./src/entry/run.ts",
"run:debug": "npm run type-check && tsx ./src/entry/run.ts",
"run:profiler": "gulp run:profiler",
"type-check": "tsc -p tsconfig.debug.json",
"gen:types": "tsc -p tsconfig.types.json",
"gen:docs": "typedoc --options ./typedoc.json --entryPointStrategy expand ./src",
"gen:items": "tsx ./src/tools/ItemTplGenerator/ItemTplGeneratorProgram.ts",

View File

@ -442,7 +442,7 @@ export class BotGenerator {
const chosenBodyTemplate = this.databaseService.getCustomization()[bot.Customization.Body];
// Find the body/hands mapping
const matchingBody: IWildBody = bodyGlobalDict[chosenBodyTemplate?._name];
const matchingBody: IWildBody = bodyGlobalDict[chosenBodyTemplate?._name]?.[bot.Customization.Body];
if (matchingBody?.isNotRandom) {
// Has fixed hands for this body, set them
bot.Customization.Hands = matchingBody.hands;

View File

@ -126,7 +126,7 @@ export class BotLootCacheService {
return false;
});
return this.cloner.clone(Object.fromEntries(filteredResult));
return this.cloner.clone(Object.fromEntries(filteredResult) as Record<string, number>);
}
return this.cloner.clone(result);

View File

@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"strict": false,
"noEmit": true
},
"exclude": ["./types/**/*"]
}