fix: hacky fix for typescript error

This commit is contained in:
NunoSempere 2022-10-26 13:53:11 +01:00
parent fc9c222a44
commit bc09456bb7

View File

@ -74,8 +74,9 @@ async function apiQuestionToFetchedQuestions(apiQuestion: ApiQuestion): Promise<
await sleep(SLEEP_TIME); await sleep(SLEEP_TIME);
const apiQuestionDetails = await fetchSingleApiQuestion(apiQuestion.id); const apiQuestionDetails = await fetchSingleApiQuestion(apiQuestion.id);
if (apiQuestionDetails.type !== "group") { if (apiQuestionDetails.type !== "group") {
throw new Error("Expected `group` type"); // shouldn't happen, this is mostly for typescript console.log("Error: expected `group` type")
} return [] //throw new Error("Expected `group` type"); // shouldn't happen, this is mostly for typescript
}else{
try{ try{
let result = (apiQuestionDetails.sub_questions || []).filter((q) => ! skip(q)).map((sq) => { let result = (apiQuestionDetails.sub_questions || []).filter((q) => ! skip(q)).map((sq) => {
const tmp = buildFetchedQuestion(sq); const tmp = buildFetchedQuestion(sq);
@ -99,6 +100,8 @@ async function apiQuestionToFetchedQuestions(apiQuestion: ApiQuestion): Promise<
console.log(error) console.log(error)
return [] return []
} }
}
} else if (apiQuestion.type === "forecast") { } else if (apiQuestion.type === "forecast") {
if (apiQuestion.group) { if (apiQuestion.group) {
return []; // sub-question, should be handled on the group level return []; // sub-question, should be handled on the group level