Files
sweet/tests/fixture_partials/routes/client_nav/_layout.tsx
T
Reed von Redwitz 35da45bff1 chore: update types in tests, init, update (#2122)
Of particular note is the change to
`tests/fixture_plugin/routes/test.tsx`. Note how I do this:
```diff
-  async GET(_req, ctx: HandlerContext<unknown, { test: string }>) {
+  async GET(_req, ctx: FreshContext<{ test: string }, unknown>) {
```

I find it strange and confusing that the order of the type parameters
has "changed". This makes it impossible to do a simple search and
replace, because people now have to change order as well.

Most of the types have been declared as `<T, S>`, i.e. data before
state:
* `PageProps<T = any, S = Record<string, unknown>>`
* `RouteContext<T = any, S = Record<string, unknown>>`
* `Handler<T = any, State = Record<string, unknown>>`
* `Handlers<T = any, State = Record<string, unknown>> `
* `AsyncRoute<T = any, S = Record<string, unknown>>`
* `PageComponent<T = any, S = Record<string, unknown>> `
* `AsyncLayout<T = any, S = Record<string, unknown>>`

And then `FreshContext` comes around like 
```
export interface FreshContext<
  State = Record<string, unknown>,
  // deno-lint-ignore no-explicit-any
  Data = any,
  NotFoundData = Data,
>
```
and switches it all up.

Not a huge issue, but just something to be aware of that others might
report.
2023-12-02 10:33:59 +01:00

49 lines
1.0 KiB
TypeScript

import { PageProps } from "$fresh/server.ts";
import { Partial } from "$fresh/runtime.ts";
import { Fader } from "../../islands/Fader.tsx";
export default function AppLayout({ Component }: PageProps) {
return (
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>fresh title</title>
</head>
<body f-client-nav>
<Partial name="body">
<Fader>
<Component />
</Fader>
</Partial>
<p>
<a
class="page-a-link"
href="/client_nav/page-a"
>
Page A
</a>
</p>
<p>
<a
class="page-b-link"
href="/client_nav/page-b"
>
Page B
</a>
</p>
<p>
<a
class="page-c-link"
href="/client_nav/page-c"
>
Page C
</a>
</p>
<pre id="logs" />
</body>
</html>
);
}