More typecheck, lint fixes
This commit is contained in:
parent
cf975330f4
commit
146b8126a2
41
src/App.tsx
41
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;
|
const {conlang} = props;
|
||||||
if (conlang === Conlang.Saimiar) {
|
if (conlang === Conlang.Saimiar) {
|
||||||
return <SaiEntry entry={ props.entry } />;
|
return <SaiEntry entry={ props.entry as SaiEntryProps } />;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (conlang === Conlang.Juteyuji) {
|
if (conlang === Conlang.Juteyuji) {
|
||||||
return <JutEntry entry={ props.entry } />;
|
return <JutEntry entry={ props.entry as JutEntryProps } />;
|
||||||
}
|
}
|
||||||
|
|
||||||
return <div>Conlang { conlang } not yet supported</div>;
|
return <div>Conlang { conlang } not yet supported</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
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 {entry} = props;
|
||||||
const synCategory = entry.syn_category;
|
const synCategory = entry.syn_category;
|
||||||
const isNominal = synCategory === 'nominal';
|
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;
|
const {entry} = props;
|
||||||
console.log(props);
|
console.log(props);
|
||||||
|
|
||||||
@ -106,7 +128,14 @@ function formatMorphology(entry) {
|
|||||||
</span>);
|
</span>);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Results = (props) => {
|
interface ResultsProps {
|
||||||
|
searchResults: any;
|
||||||
|
searchTerm: string;
|
||||||
|
conlang: Conlang;
|
||||||
|
direction: SearchDirection;
|
||||||
|
}
|
||||||
|
|
||||||
|
const Results = (props: ResultsProps) => {
|
||||||
const content = () => {
|
const content = () => {
|
||||||
const {conlang} = props;
|
const {conlang} = props;
|
||||||
const num = props.searchResults.length;
|
const num = props.searchResults.length;
|
||||||
|
Loading…
Reference in New Issue
Block a user