Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit 72b5d87

Browse files
committed
fix: improve types
1 parent 8608b45 commit 72b5d87

File tree

6 files changed

+23
-16
lines changed

6 files changed

+23
-16
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/Barcode/Barcode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import JsBarcode from "jsbarcode";
22
import { chakra } from "@chakra-ui/react";
33

44
export default ({ value }: { value: string }) => {
5-
const barcodeCallback = (el: Element) => {
5+
const barcodeCallback = (el: Element | null) => {
66
if (el) {
77
JsBarcode(el, value);
88
}

src/components/DTTPeriod/DTTPeriod.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ export const DTTPeriod = ({
4040
leftContent={period.name}
4141
leftContentSize={"xs"}
4242
transition={
43-
period?.name === "Transition" ||
44-
DateTime.fromISO(`${period?.date}T15:15`) <= period.time ||
45-
period.time <= DateTime.fromISO(`${period?.date}T09:00`)
43+
period?.time
44+
? period?.name === "Transition" ||
45+
DateTime.fromISO(`${period?.date}T15:15`) <= period?.time ||
46+
period?.time <= DateTime.fromISO(`${period?.date}T09:00`)
47+
: true
4648
}
4749
isLoaded={isLoaded}
4850
rightContent={

src/components/NavButton/NavButton.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
} from "../../stores/auth";
88

99
const InstallButton = () => {
10-
const deferredPrompt = useRef<BeforeInstallPromptEvent>(null);
10+
const deferredPrompt = useRef<BeforeInstallPromptEvent | null>(null);
1111
const [showInstall, setShowInstall] = useState(false);
1212

1313
window.addEventListener(
@@ -30,8 +30,8 @@ const InstallButton = () => {
3030
<Button
3131
mr={1}
3232
onClick={async () => {
33-
deferredPrompt.current.prompt();
34-
await deferredPrompt.current.userChoice;
33+
deferredPrompt.current?.prompt();
34+
await deferredPrompt.current?.userChoice;
3535
deferredPrompt.current = null;
3636
setShowInstall(false);
3737
}}

src/components/RefetchingIndicator/RefetchingIndicator.tsx

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,10 @@ export default () => {
88
const isFetching = useIsFetching();
99
const [online, setOnline] = useState(true);
1010

11-
document.addEventListener(
12-
"onlinechange",
13-
({ detail: { online } }: CustomEvent<{ online: boolean }>) => {
14-
log(`Online status change detected - Online: ${online}`);
15-
return setOnline(online);
16-
}
17-
);
11+
document.addEventListener("onlinechange", ({ detail: { online } }) => {
12+
log(`Online status change detected - Online: ${online}`);
13+
return setOnline(online);
14+
});
1815

1916
return (
2017
<Flex p={2} rounded="full" align={"center"} gap={3}>

src/index.d.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,11 @@ interface BeforeInstallPromptEvent extends Event {
2929
*/
3030
prompt(): Promise<void>;
3131
}
32+
33+
interface WindowEventMap {
34+
beforeinstallprompt: BeforeInstallPromptEvent;
35+
}
36+
37+
interface DocumentEventMap {
38+
onlinechange: CustomEvent<{ online: boolean }>;
39+
}

0 commit comments

Comments
 (0)