From 615d7f06aa5a23fcd34ecdb6de688203b615ef4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com> Date: Mon, 27 May 2024 21:08:05 -0500 Subject: [PATCH] fix: typing parity --- .vscode/settings.json | 3 ++- package.json | 2 +- src/components/Armor/components/ShotDisplay.tsx | 4 +++- src/core/blitz/canSplash.ts | 6 +++--- src/core/blitz/isExplosive.ts | 6 +++--- yarn.lock | 8 ++++---- 6 files changed, 16 insertions(+), 13 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 34fa56e76..5f9e35100 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -182,5 +182,6 @@ ], "deno.enable": false, "deno.unstable": false, - "cSpell.enableFiletypes": ["glsl"] + "cSpell.enableFiletypes": ["glsl"], + "typescript.tsdk": "node_modules\\typescript\\lib" } diff --git a/package.json b/package.json index a356f3752..78c9a0ca5 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "lz4": "^0.6.5", "prettier": "^3.0.3", "prisma": "^5.4.1", - "typescript": "^5.2.2" + "typescript": "^5.4.5" }, "packageManager": "yarn@1.22.1" } diff --git a/src/components/Armor/components/ShotDisplay.tsx b/src/components/Armor/components/ShotDisplay.tsx index 75ffbe1f4..203e0be70 100644 --- a/src/components/Armor/components/ShotDisplay.tsx +++ b/src/components/Armor/components/ShotDisplay.tsx @@ -163,7 +163,9 @@ export function ShotDisplay() { (shot.out.layers.at(-1) as ShotLayerNonExternal).point, ) : LENGTH_INFINITY; - const inLast = shot.in.layers.findLast((layer) => layer.type !== null)!; + const inLast = shot.in.layers.findLast( + (layer) => layer.type !== null, + ) as ShotLayerNonExternal; const outTitleColor = shot.out ? shotStatusColors[shot.out.status] : undefined; diff --git a/src/core/blitz/canSplash.ts b/src/core/blitz/canSplash.ts index fabf5755e..9d1b32067 100644 --- a/src/core/blitz/canSplash.ts +++ b/src/core/blitz/canSplash.ts @@ -1,5 +1,5 @@ -import { ShellDefinition } from '../blitzkit/tankDefinitions'; +import { ShellDefinition, ShellType } from '../blitzkit/tankDefinitions'; -export function canSplash(type: ShellDefinition['type']): type is 'he' { - return type === 'he'; +export function canSplash(type: ShellDefinition['type']): type is ShellType.HE { + return type === ShellType.HE; } diff --git a/src/core/blitz/isExplosive.ts b/src/core/blitz/isExplosive.ts index 6b5c23883..08847774f 100644 --- a/src/core/blitz/isExplosive.ts +++ b/src/core/blitz/isExplosive.ts @@ -1,7 +1,7 @@ -import { ShellDefinition } from '../blitzkit/tankDefinitions'; +import { ShellDefinition, ShellType } from '../blitzkit/tankDefinitions'; export function isExplosive( type: ShellDefinition['type'], -): type is 'he' | 'hc' { - return type === 'he' || type === 'hc'; +): type is ShellType.HEAT | ShellType.HE { + return type === ShellType.HEAT || type === ShellType.HE; } diff --git a/yarn.lock b/yarn.lock index 94ab225ee..27c04df31 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5801,10 +5801,10 @@ type-is@~1.6.18: media-typer "0.3.0" mime-types "~2.1.24" -typescript@^5.2.2: - version "5.3.3" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.3.3.tgz#b3ce6ba258e72e6305ba66f5c9b452aaee3ffe37" - integrity sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw== +typescript@^5.4.5: + version "5.4.5" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" + integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== ua-parser-js@^1.0.33: version "1.0.37"