From 146b8126a2d987717fd0c279ca9d377f8f13d497 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 12 Sep 2021 21:35:46 -0700 Subject: [PATCH] More typecheck, lint fixes --- src/App.tsx | 41 +++++++++++++++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 2690501..fd2066b 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -44,20 +44,34 @@ function makeRequest(queryString, jsonHandler) { }); } -const Entry = (props) => { +interface EntryProps { + conlang: Conlang; + entry: SaiEntryProps | JutEntryProps; + key: string; +} + +const Entry = (props: EntryProps) => { const {conlang} = props; if (conlang === Conlang.Saimiar) { - return ; + return ; } if (conlang === Conlang.Juteyuji) { - return ; + return ; } return
Conlang { conlang } not yet supported
; }; -const SaiEntry = (props) => { +interface SaiEntryProps { + id: number; + sai: string; + eng: string; + syn_category: string; + morph_type: string; +} + +const SaiEntry = (props: {entry: SaiEntryProps}) => { const {entry} = props; const synCategory = entry.syn_category; const isNominal = synCategory === 'nominal'; @@ -75,7 +89,15 @@ const SaiEntry = (props) => { ); }; -const JutEntry = (props) => { +interface JutEntryProps { + id: number; + jut: string; + eng: string; + syn_category: string; + gender: string; +} + +const JutEntry = (props: {entry: JutEntryProps}) => { const {entry} = props; console.log(props); @@ -106,7 +128,14 @@ function formatMorphology(entry) { ); } -const Results = (props) => { +interface ResultsProps { + searchResults: any; + searchTerm: string; + conlang: Conlang; + direction: SearchDirection; +} + +const Results = (props: ResultsProps) => { const content = () => { const {conlang} = props; const num = props.searchResults.length;