Skip to content

Commit 2d3cd00

Browse files
fix: help me typecheck god
1 parent 282a28b commit 2d3cd00

File tree

7 files changed

+18
-16
lines changed

7 files changed

+18
-16
lines changed

src/app.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export default function App() {
2020
createEffect(() => {
2121
const html = document.documentElement;
2222
html.classList.remove("light", "dark");
23-
html.classList.add(ctx.selectedTheme().value);
24-
html.dataset.theme = ctx.selectedTheme().theme;
23+
html.classList.add(ctx.selectedTheme()!.value);
24+
html.dataset.theme = ctx.selectedTheme()!.theme;
2525
});
2626

2727
return (

src/data/page-state.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import { createContext, ParentProps, useContext } from "solid-js";
22
import { SetStoreFunction, createStore } from "solid-js/store";
33

4-
type ChildSection = {
5-
text: string | undefined;
4+
export type ChildSection = {
5+
text?: string | null;
66
id: string;
77
level: number;
88
};
99

10-
type ParentSection = {
11-
text: string | undefined;
10+
export type ParentSection = {
11+
text?: string | null;
1212
id: string;
1313
level: number;
14-
children: ChildSection[] | [];
14+
children: ChildSection[];
1515
};
1616

1717
type PageStateStore = {

src/data/theme-provider.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const ThemeProvider = (props: ParentProps) => {
7070
});
7171
createEffect(() => {
7272
if (selectedTheme()?.value)
73-
document.cookie = `theme=${selectedTheme().value};path=/;max-age=${60 * 60 * 24 * 365}`;
73+
document.cookie = `theme=${selectedTheme()!.value};path=/;max-age=${60 * 60 * 24 * 365}`;
7474
});
7575
return (
7676
<ThemeCtx.Provider

src/entry-client.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
import { mount, StartClient } from "@solidjs/start/client";
22

3-
mount(() => <StartClient />, document.getElementById("app"));
3+
mount(() => <StartClient />, document.getElementById("app")!);

src/ui/eraser-link/index.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default function EraserOrAnchor(props: ParentProps<{ href: string }>) {
9797

9898
return (
9999
<Show
100-
when={eraserLinkData !== null}
100+
when={eraserLinkData}
101101
fallback={
102102
<a
103103
{...props}
@@ -108,7 +108,9 @@ export default function EraserOrAnchor(props: ParentProps<{ href: string }>) {
108108
</a>
109109
}
110110
>
111-
<EraserLink linkData={eraserLinkData}>{props.children}</EraserLink>
111+
{(eraserLinkData) => (
112+
<EraserLink linkData={eraserLinkData()}>{props.children}</EraserLink>
113+
)}
112114
</Show>
113115
);
114116
}

src/ui/layout/table-of-contents.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
type ResolvedChildren,
1010
} from "solid-js";
1111
import { useLocation } from "@solidjs/router";
12-
import { usePageState } from "~/data/page-state";
12+
import { ChildSection, ParentSection, usePageState } from "~/data/page-state";
1313
import { useI18n } from "~/i18n/i18n-context";
1414

1515
export const TableOfContents: Component<{ children: ResolvedChildren }> = (
@@ -49,7 +49,7 @@ export const TableOfContents: Component<{ children: ResolvedChildren }> = (
4949
}
5050

5151
const headings = document.querySelectorAll("main h2, main h3");
52-
const sections: unknown[] = [];
52+
const sections: ParentSection[] = [];
5353

5454
if (headings) {
5555
headings.forEach((heading) => {

src/ui/pagination.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import { A } from "~/ui/i18n-anchor";
22
import { Show, Suspense, createMemo } from "solid-js";
3-
import flatEntries from "solid:collection/entries";
3+
import { coreEntries } from "solid:collection";
44
import { useI18n } from "~/i18n/i18n-context";
55

66
/**
77
* temporary until we have proper types inside collections
88
*/
9-
type ReferenceCollection = (typeof flatEntries)["references"];
10-
type LearnCollection = (typeof flatEntries)["learn"];
9+
type ReferenceCollection = (typeof coreEntries)["reference"];
10+
type LearnCollection = (typeof coreEntries)["learn"];
1111

1212
type Pagination = {
1313
collection: ReferenceCollection | LearnCollection;

0 commit comments

Comments
 (0)