From bc09456bb70ecc76e726b61b67b70fb4803b3ffd Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Wed, 26 Oct 2022 13:53:11 +0100 Subject: [PATCH] fix: hacky fix for typescript error --- src/backend/platforms/metaculus/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/backend/platforms/metaculus/index.ts b/src/backend/platforms/metaculus/index.ts index c383643..3a129ec 100644 --- a/src/backend/platforms/metaculus/index.ts +++ b/src/backend/platforms/metaculus/index.ts @@ -74,8 +74,9 @@ async function apiQuestionToFetchedQuestions(apiQuestion: ApiQuestion): Promise< await sleep(SLEEP_TIME); const apiQuestionDetails = await fetchSingleApiQuestion(apiQuestion.id); 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{ let result = (apiQuestionDetails.sub_questions || []).filter((q) => ! skip(q)).map((sq) => { const tmp = buildFetchedQuestion(sq); @@ -99,6 +100,8 @@ async function apiQuestionToFetchedQuestions(apiQuestion: ApiQuestion): Promise< console.log(error) return [] } + } + } else if (apiQuestion.type === "forecast") { if (apiQuestion.group) { return []; // sub-question, should be handled on the group level