remove most uses of as any in typescript

- replaced many uses of `as any` with another more specific cast `as T`
- filled in missing typed for items that needed to be typed
  - new runtime code was added where necessary to satisfy the new types with comments
- added missing theme variable "sidebar-active" to the Theme variables
- forms using `react-hook-form` are now typechecked
- changed some instances of `target` into `currentTarget` while removing `as any` assertions
This commit is contained in:
bree
2021-07-04 07:09:39 -04:00
parent 841320aab7
commit a4051330a3
31 changed files with 161 additions and 117 deletions

View File

@@ -1,7 +1,7 @@
import ComboBox from "../ui/ComboBox";
import { connectState } from "../../redux/connector";
import { WithDispatcher } from "../../redux/reducers";
import { LanguageEntry, Languages } from "../../context/Locale";
import { Language, LanguageEntry, Languages } from "../../context/Locale";
type Props = WithDispatcher & {
locale: string;
@@ -15,12 +15,12 @@ export function LocaleSelector(props: Props) {
props.dispatcher &&
props.dispatcher({
type: "SET_LOCALE",
locale: e.currentTarget.value as any
locale: e.currentTarget.value as Language
})
}
>
{Object.keys(Languages).map(x => {
const l = (Languages as any)[x] as LanguageEntry;
const l = Languages[x as keyof typeof Languages];
return (
<option value={x}>
{l.emoji} {l.display}