Skip to content

Commit 12b2bd0

Browse files
committed
improve type access
1 parent 328294f commit 12b2bd0

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/lib/bridge/handlers/fetch_inspect_info.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const FetchInspectInfo = new SimpleHandler<FetchInspectInfoRequest, Fetch
7272

7373
try {
7474
const schema = await gSchemaFetcher.getSchema();
75-
const weapon = schema.weapons?.[String(defindex)];
75+
const weapon = schema.weapons[defindex];
7676
const paint = getSchemaPaint(weapon, paintindex);
7777

7878
weaponType = weapon?.name;
@@ -120,13 +120,13 @@ export const FetchInspectInfo = new SimpleHandler<FetchInspectInfoRequest, Fetch
120120
}
121121
);
122122

123-
function getSchemaPaint(weapon: ItemSchema.RawWeapon, paintIndex: number) {
123+
function getSchemaPaint(weapon: ItemSchema.RawWeapon | undefined, paintIndex: number) {
124124
if (!weapon) {
125125
return;
126126
}
127127

128-
if (weapon.paints?.[String(paintIndex)] !== undefined) {
129-
return weapon.paints[String(paintIndex)];
128+
if (weapon.paints[paintIndex] !== undefined) {
129+
return weapon.paints[paintIndex];
130130
}
131131

132132
if (weapon.paints?.['0'] !== undefined) {

0 commit comments

Comments
 (0)