From 8bc93d02099dca1c09c584a6e5d412a9a491bc64 Mon Sep 17 00:00:00 2001 From: Dave Welsh <33357025+davewelsh@users.noreply.github.com> Date: Mon, 22 Aug 2022 05:42:24 -0400 Subject: [PATCH] Typescript Documentation Improvement for Persistent Layouts (#33659) By making `NextPageWithLayout` generic and passing the type parameters to `NextPage`, our pages can continue to specify the props explicitly. This gives us type safety in `getInitialProps`, for example. ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes by running `yarn lint` --- docs/basic-features/layouts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/basic-features/layouts.md b/docs/basic-features/layouts.md index 5afa956ec29e..394169e9f0a6 100644 --- a/docs/basic-features/layouts.md +++ b/docs/basic-features/layouts.md @@ -128,7 +128,7 @@ import type { ReactElement, ReactNode } from 'react' import type { NextPage } from 'next' import type { AppProps } from 'next/app' -export type NextPageWithLayout = NextPage & { +export type NextPageWithLayout

= NextPage & { getLayout?: (page: ReactElement) => ReactNode }