moved challenge type to MonkeyTypes, fixed challenge type

This commit is contained in:
Miodec 2022-02-21 01:24:18 +01:00
parent 99b92ea947
commit 1bca0a3734
2 changed files with 16 additions and 12 deletions

View file

@ -322,18 +322,8 @@ export async function findCurrentGroup(
return retgroup;
}
type Challenge = {
name: string;
display: string;
autoRole: boolean;
type: string;
parameters: string | number[];
message: string;
requirements: object;
};
let challengeList: Challenge[] = [];
export async function getChallengeList(): Promise<Challenge[]> {
let challengeList: MonkeyTypes.Challenge[] = [];
export async function getChallengeList(): Promise<MonkeyTypes.Challenge[]> {
if (challengeList.length === 0) {
return $.getJSON("challenges/_list.json", function (data) {
challengeList = data;

View file

@ -572,4 +572,18 @@ declare namespace MonkeyTypes {
[row4: string]: string[];
[row5: string]: string[];
}
interface Challenge {
name: string;
display: string;
autoRole: boolean;
type: string;
parameters: (string | number | boolean)[];
message: string;
requirements: {
[requirement: string]: {
[parameter: string]: string | number | boolean;
};
};
}
}