From 18d39224a9c3beb284fde65da6c20d416e9b5b50 Mon Sep 17 00:00:00 2001 From: Alex McAuliffe Date: Mon, 19 Aug 2024 13:39:08 +0000 Subject: [PATCH] Add types for variables on global scope. (!398) Adds a type definition for the variables added to the global scope. Personally i'd probably stick them in an object off the route and drop the G_prefix but didn't want to make any major changes with no reason. Reviewed-on: https://dev.sp-tarkov.com/SPT/Server/pulls/398 Co-authored-by: Alex McAuliffe Co-committed-by: Alex McAuliffe --- project/src/global.d.ts | 14 ++++++++++++++ project/src/ide/TestEntry.ts | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 project/src/global.d.ts diff --git a/project/src/global.d.ts b/project/src/global.d.ts new file mode 100644 index 00000000..6eed4137 --- /dev/null +++ b/project/src/global.d.ts @@ -0,0 +1,14 @@ +export type {}; + +declare global { + var G_DEBUG_CONFIGURATION: boolean; + var G_RELEASE_CONFIGURATION: boolean; + var G_MODS_ENABLED: boolean; + var G_MODS_TRANSPILE_TS: boolean; + var G_LOG_REQUESTS: boolean; + var G_WATERMARK_ENABLED: boolean; + + var G_SPTVERSION: string; + var G_COMMIT: string; + var G_BUILDTIME: number; +} diff --git a/project/src/ide/TestEntry.ts b/project/src/ide/TestEntry.ts index d37d4685..e6513e3a 100644 --- a/project/src/ide/TestEntry.ts +++ b/project/src/ide/TestEntry.ts @@ -16,7 +16,7 @@ globalThis.G_WATERMARK_ENABLED = false; globalThis.G_SPTVERSION = ""; globalThis.G_COMMIT = ""; -globalThis.G_BUILDTIME = ""; +globalThis.G_BUILDTIME = 0; const program = new Program(); program.start();