Typescript errors: zero

This commit is contained in:
0x1eef 2024-10-29 13:05:06 -03:00
parent 51d65a74a1
commit 0ef11405f4
6 changed files with 6 additions and 11 deletions

View file

@ -10,6 +10,7 @@
"target": "ES5",
"moduleResolution": "node",
"esModuleInterop": true,
"jsxImportSource": "preact",
"jsx": "react-jsx",
"lib": [ "ES2020", "DOM" ],
"typeRoots": ["../src/js/types/globals.d.ts", "../node_modules/@types"],

View file

@ -42,7 +42,7 @@ export function LanguageSelect() {
const ctx = el?.getAttribute("data-context");
if (ctx === "language-select") {
const anchor = getNextRef(e, refs)?.current;
anchor.focus();
anchor?.focus();
}
}
}

View file

@ -2,7 +2,7 @@ import type { ReactNode, AnchorHTMLAttributes, ForwardedRef } from "preact/compa
type Rest = AnchorHTMLAttributes<HTMLAnchorElement>;
type Props = {
value: string;
children: ReactNode;
children?: ReactNode;
} & Rest;
function Component(props: Props, ref: ForwardedRef<HTMLAnchorElement>) {

View file

@ -36,7 +36,7 @@ export function ThemeSelect() {
const ctx = el?.getAttribute("data-context");
if (ctx === "theme-select") {
const anchor = getNextRef(e, refs)?.current;
anchor.focus();
anchor?.focus();
}
}
}

View file

@ -45,9 +45,8 @@ export function SurahStream({ surahId, localeId, t }: Props) {
history.back();
}
}
const el = document.activeElement;
el.addEventListener("keydown", onKeyPress);
return () => el.removeEventListener("keydown", onKeyPress);
document.addEventListener("keydown", onKeyPress);
return () => document.removeEventListener("keydown", onKeyPress);
}, []);
useEffect(() => {

View file

@ -62,15 +62,10 @@ const App = (function () {
const [locale, setLocale] = useLocale();
return (
<SettingsContext.Provider value={{ locale, setLocale, theme, setTheme }}>
{/* @ts-expect-error fixme */}
<Router>
{/* @ts-expect-error fixme */}
<Route path="/index.html" component={SurahRedirect} />
{/* @ts-expect-error fixme */}
<Route path="/:localeId/index.html" component={SurahIndex} t={t} />
{/* @ts-expect-error fixme */}
<Route path="/:localeId/:surahId" component={SurahStream} t={t} />
{/* @ts-expect-error fixme */}
<Route path="/:localeId/random" component={RandomSurah} />
</Router>
</SettingsContext.Provider>