make typescript verify enemyStatKey is comprehensive
This commit is contained in:
parent
8b0ba0b84a
commit
71c96f248d
@ -137,12 +137,14 @@ export const updateStats = async (accountOwnerId: string, payload: IStatsUpdate)
|
||||
case "HEADSHOT":
|
||||
case "KILL_ASSIST": {
|
||||
playerStats.Enemies ??= [];
|
||||
const enemyStatKey = {
|
||||
KILL_ENEMY: "kills",
|
||||
EXECUTE_ENEMY: "executions",
|
||||
HEADSHOT: "headshots",
|
||||
KILL_ASSIST: "assists"
|
||||
}[category] as "kills" | "executions" | "headshots" | "assists";
|
||||
const enemyStatKey = (
|
||||
{
|
||||
KILL_ENEMY: "kills",
|
||||
EXECUTE_ENEMY: "executions",
|
||||
HEADSHOT: "headshots",
|
||||
KILL_ASSIST: "assists"
|
||||
} as const
|
||||
)[category];
|
||||
|
||||
for (const [type, count] of Object.entries(data as IUploadEntry)) {
|
||||
const enemy = playerStats.Enemies.find(element => element.type === type);
|
||||
|
Loading…
x
Reference in New Issue
Block a user