mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-09 13:44:29 +08:00
chore: add proper types for wordset and section
This commit is contained in:
parent
aec04bc8cc
commit
6032c967ed
2 changed files with 15 additions and 1 deletions
|
|
@ -617,7 +617,7 @@ export async function addWord(): Promise<void> {
|
|||
|
||||
let wordCount = 0;
|
||||
for (let i = 0; i < section.words.length; i++) {
|
||||
const word = section.words[i];
|
||||
const word = section.words[i] as string;
|
||||
if (wordCount >= Config.words && Config.mode === "words") {
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
14
frontend/src/ts/types/types.d.ts
vendored
14
frontend/src/ts/types/types.d.ts
vendored
|
|
@ -108,6 +108,20 @@ declare namespace MonkeyTypes {
|
|||
| "changesWordsFrequency"
|
||||
| `wordOrder:${FunboxWordOrder}`;
|
||||
|
||||
class Wordset {
|
||||
public words: string[];
|
||||
public length: number;
|
||||
constructor(words: string[]);
|
||||
randomWord(mode: MonkeyTypes.FunboxWordsFrequency): string;
|
||||
}
|
||||
|
||||
class Section {
|
||||
public title: string;
|
||||
public author: string;
|
||||
public words: string[];
|
||||
constructor(title: string, author: string, words: string[]);
|
||||
}
|
||||
|
||||
type FunboxFunctions = {
|
||||
getWord?: (wordset?: Wordset, wordIndex?: number) => string;
|
||||
punctuateWord?: (word: string) => string;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue