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",
 | 
					                                {
 | 
				
			||||||
                                EXECUTE_ENEMY: "executions",
 | 
					                                    KILL_ENEMY: "kills",
 | 
				
			||||||
                                HEADSHOT: "headshots",
 | 
					                                    EXECUTE_ENEMY: "executions",
 | 
				
			||||||
                                KILL_ASSIST: "assists"
 | 
					                                    HEADSHOT: "headshots",
 | 
				
			||||||
                            }[category] as "kills" | "executions" | "headshots" | "assists";
 | 
					                                    KILL_ASSIST: "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