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 "HEADSHOT":
|
||||||
case "KILL_ASSIST": {
|
case "KILL_ASSIST": {
|
||||||
playerStats.Enemies ??= [];
|
playerStats.Enemies ??= [];
|
||||||
const enemyStatKey = {
|
const enemyStatKey = (
|
||||||
|
{
|
||||||
KILL_ENEMY: "kills",
|
KILL_ENEMY: "kills",
|
||||||
EXECUTE_ENEMY: "executions",
|
EXECUTE_ENEMY: "executions",
|
||||||
HEADSHOT: "headshots",
|
HEADSHOT: "headshots",
|
||||||
KILL_ASSIST: "assists"
|
KILL_ASSIST: "assists"
|
||||||
}[category] as "kills" | "executions" | "headshots" | "assists";
|
} as const
|
||||||
|
)[category];
|
||||||
|
|
||||||
for (const [type, count] of Object.entries(data as IUploadEntry)) {
|
for (const [type, count] of Object.entries(data as IUploadEntry)) {
|
||||||
const enemy = playerStats.Enemies.find(element => element.type === type);
|
const enemy = playerStats.Enemies.find(element => element.type === type);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user