Unverified Commit 8bc93d02 authored by Dave Welsh's avatar Dave Welsh Committed by GitHub

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`
parent 28746520
...@@ -128,7 +128,7 @@ import type { ReactElement, ReactNode } from 'react' ...@@ -128,7 +128,7 @@ import type { ReactElement, ReactNode } from 'react'
import type { NextPage } from 'next' import type { NextPage } from 'next'
import type { AppProps } from 'next/app' import type { AppProps } from 'next/app'
export type NextPageWithLayout = NextPage & { export type NextPageWithLayout<P = {}, IP = P> = NextPage<P, IP> & {
getLayout?: (page: ReactElement) => ReactNode getLayout?: (page: ReactElement) => ReactNode
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment