misc: types issues
This commit is contained in:
parent
6e53c47b4c
commit
5c00cd447d
1 changed files with 4 additions and 4 deletions
|
@ -19,11 +19,11 @@
|
||||||
difficultyList?: string;
|
difficultyList?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
let name = '';
|
let name: string = '';
|
||||||
let themeList: string[] = [];
|
let themeList: string[] = [];
|
||||||
let difficultyList: string[] = [];
|
let difficultyList: string[] = [];
|
||||||
|
|
||||||
const difficulties = data.chapter?.puzzles?.reduce((acc, puzzle) => {
|
const difficulties = data.chapter?.puzzles?.reduce((acc: Record<string, string>, puzzle) => {
|
||||||
const tag = puzzle.tags?.find((tag) =>
|
const tag = puzzle.tags?.find((tag) =>
|
||||||
['easy', 'medium', 'hard'].includes(tag.name.toLowerCase())
|
['easy', 'medium', 'hard'].includes(tag.name.toLowerCase())
|
||||||
);
|
);
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
return acc;
|
return acc;
|
||||||
}, {}) as Record<string, string>;
|
}, {}) as Record<string, string>;
|
||||||
|
|
||||||
const themes = data.chapter?.puzzles?.reduce((acc, puzzle) => {
|
const themes = data.chapter?.puzzles?.reduce((acc: Record<string, string>, puzzle) => {
|
||||||
puzzle.tags?.forEach((tag) => {
|
puzzle.tags?.forEach((tag) => {
|
||||||
if (!['easy', 'medium', 'hard'].includes(tag.name.toLowerCase())) {
|
if (!['easy', 'medium', 'hard'].includes(tag.name.toLowerCase())) {
|
||||||
acc[tag.name] = tag.name.toLowerCase();
|
acc[tag.name] = tag.name.toLowerCase();
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
|
|
||||||
export const snapshot: Snapshot<Filters> = {
|
export const snapshot: Snapshot<Filters> = {
|
||||||
capture: () => ({
|
capture: () => ({
|
||||||
name,
|
name: name,
|
||||||
themeList: themeList.length ? themeList.join(',') : '',
|
themeList: themeList.length ? themeList.join(',') : '',
|
||||||
difficultyList: difficultyList.length ? difficultyList.join(',') : ''
|
difficultyList: difficultyList.length ? difficultyList.join(',') : ''
|
||||||
}),
|
}),
|
||||||
|
|
Loading…
Add table
Reference in a new issue