fix: add missing state property to interface (#1579)

This commit is contained in:
Christian Svensson
2023-08-08 14:15:53 +02:00
committed by GitHub
parent 8325225a0d
commit 7d4c751105
3 changed files with 13 additions and 2 deletions
+10 -1
View File
@@ -1,10 +1,19 @@
import { UnknownPageProps } from "$fresh/server.ts";
export default function NotFoundPage({ data, url }: UnknownPageProps) {
type Data = { hello: string };
type State = { root: string };
export default function NotFoundPage(
{ data, state, url }: UnknownPageProps<Data | undefined, State>,
) {
// Checks that we have the correct type for state
state.root satisfies string;
return (
<>
<p>404 not found: {url.pathname}</p>
{data?.hello && <p>Hello {data.hello}</p>}
<p>State root: {state.root}</p>
</>
);
}