From 967a040d5b4dfeacdfea65af1af3704dc3a74d89 Mon Sep 17 00:00:00 2001 From: Fraser Date: Mon, 12 Jun 2023 20:09:33 -0400 Subject: [PATCH] fix typescript error --- web/src/searchbox.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/src/searchbox.tsx b/web/src/searchbox.tsx index ba7a073..26fc7e6 100644 --- a/web/src/searchbox.tsx +++ b/web/src/searchbox.tsx @@ -9,7 +9,7 @@ export type Followup = { } // initial questions to fill the search box with. -export const initialQuestions = [ +export const initialQuestions: string[] = [ "What is an AI arms race?", "What is AI safety and alignment?", "I'm not convinced, why is this important?", @@ -40,7 +40,7 @@ export const SearchBox: React.FC<{search: ( ) => void, }> = ({search}) => { - const initial_query = initialQuestions[Math.floor(Math.random() * initialQuestions.length)]; + const initial_query = initialQuestions[Math.floor(Math.random() * initialQuestions.length)] || ""; const [ query, setQuery ] = useState(initial_query); const [ loading, setLoading ] = useState(false);