Skip to content
8 changes: 6 additions & 2 deletions frontend/src/ts/test/test-input.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,11 @@ export const corrected = new Corrected();
export let keypressCountHistory: number[] = [];
let currentKeypressCount = 0;
export let currentBurstStart = 0;
export let missedWords: Record<string, number> = {};
type MissedWordsType = Record<string, number>;
// We're using Object.create(null) to make sure that __proto__ won't have any special meaning when it's used to index the missedWords object (so if a user mistypes the word __proto__ it will appear in the practise words test)
export let missedWords: MissedWordsType = Object.create(
null,
) as MissedWordsType;
export let accuracy = {
correct: 0,
incorrect: 0,
Expand Down Expand Up @@ -542,7 +546,7 @@ export function restart(): void {
words: [],
};
currentBurstStart = 0;
missedWords = {};
missedWords = Object.create(null) as MissedWordsType;
accuracy = {
correct: 0,
incorrect: 0,
Expand Down