docs: Remove references to deprecated types (#2125)
As per the [1.6 release](https://deno.com/blog/fresh-1.6#simplified-typings), and commentary by @csvn [here](https://github.com/denoland/fresh/issues/2108#issuecomment-1836625789), this PR aims to replace the references to deprecated typing in the documentation. Please see inline commentary for parts I'm unclear on.
This commit is contained in:
@@ -12,12 +12,12 @@ throws an error respectively.
|
||||
|
||||
The 404 page can be customized by creating a `_404.tsx` file in the `routes/`
|
||||
folder. The file must have a default export that is a regular Preact component.
|
||||
A props object of type `UnknownPageProps` is passed in as an argument.
|
||||
A props object of type `PageProps` is passed in as an argument.
|
||||
|
||||
```tsx routes/_404.tsx
|
||||
import { UnknownPageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "$fresh/server.ts";
|
||||
|
||||
export default function NotFoundPage({ url }: UnknownPageProps) {
|
||||
export default function NotFoundPage({ url }: PageProps) {
|
||||
return <p>404 not found: {url.pathname}</p>;
|
||||
}
|
||||
```
|
||||
@@ -71,12 +71,12 @@ export const handler: Handlers = {
|
||||
|
||||
The 500 page can be customized by creating a `_500.tsx` file in the `routes/`
|
||||
folder. The file must have a default export that is a regular Preact component.
|
||||
A props object of type `ErrorPageProps` is passed in as an argument.
|
||||
A props object of type `PageProps` is passed in as an argument.
|
||||
|
||||
```tsx routes/_500.tsx
|
||||
import { ErrorPageProps } from "$fresh/server.ts";
|
||||
import { PageProps } from "$fresh/server.ts";
|
||||
|
||||
export default function Error500Page({ error }: ErrorPageProps) {
|
||||
export default function Error500Page({ error }: PageProps) {
|
||||
return <p>500 internal error: {(error as Error).message}</p>;
|
||||
}
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user