Move type definitions

This commit is contained in:
Greg Shuflin 2021-09-12 21:43:26 -07:00
parent 146b8126a2
commit 12207c30b1
2 changed files with 19 additions and 17 deletions

View File

@ -2,6 +2,7 @@ import React, {Component} from 'react';
import './App.scss'; import './App.scss';
import {declineSaimiar} from './saimiar_morphology'; import {declineSaimiar} from './saimiar_morphology';
import {SaiEntryProps, JutEntryProps } from './dbtypes';
const backendUrl = 'https://kucinakobackend.ichigo.everydayimshuflin.com'; const backendUrl = 'https://kucinakobackend.ichigo.everydayimshuflin.com';
@ -63,14 +64,6 @@ const Entry = (props: EntryProps) => {
return <div>Conlang { conlang } not yet supported</div>; return <div>Conlang { conlang } not yet supported</div>;
}; };
interface SaiEntryProps {
id: number;
sai: string;
eng: string;
syn_category: string;
morph_type: string;
}
const SaiEntry = (props: {entry: SaiEntryProps}) => { const SaiEntry = (props: {entry: SaiEntryProps}) => {
const {entry} = props; const {entry} = props;
const synCategory = entry.syn_category; const synCategory = entry.syn_category;
@ -89,14 +82,6 @@ const SaiEntry = (props: {entry: SaiEntryProps}) => {
); );
}; };
interface JutEntryProps {
id: number;
jut: string;
eng: string;
syn_category: string;
gender: string;
}
const JutEntry = (props: {entry: JutEntryProps}) => { const JutEntry = (props: {entry: JutEntryProps}) => {
const {entry} = props; const {entry} = props;
console.log(props); console.log(props);
@ -129,7 +114,7 @@ function formatMorphology(entry) {
} }
interface ResultsProps { interface ResultsProps {
searchResults: any; searchResults: Array<any>;
searchTerm: string; searchTerm: string;
conlang: Conlang; conlang: Conlang;
direction: SearchDirection; direction: SearchDirection;

17
src/dbtypes.ts Normal file
View File

@ -0,0 +1,17 @@
interface SaiEntryProps {
id: number;
sai: string;
eng: string;
syn_category: string;
morph_type: string;
}
interface JutEntryProps {
id: number;
jut: string;
eng: string;
syn_category: string;
gender: string;
}
export { SaiEntryProps, JutEntryProps };