Commit cc6eecd2 authored by Dmytro's avatar Dmytro Committed by Luis Fernando Alvarez D

Allow to describe initial props in the NextPage type (#7491)

parent 725f8c2b
...@@ -27,14 +27,14 @@ declare module 'react' { ...@@ -27,14 +27,14 @@ declare module 'react' {
/** /**
* `Page` type, use it as a guide to create `pages`. * `Page` type, use it as a guide to create `pages`.
*/ */
export type NextPage<P = {}> = { export type NextPage<P = {}, IP = P> = {
(props: P): JSX.Element (props: P): JSX.Element
/** /**
* Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered. * Used for initial page load data population. Data returned from `getInitialProps` is serialized when server rendered.
* Make sure to return plain `Object` without using `Date`, `Map`, `Set`. * Make sure to return plain `Object` without using `Date`, `Map`, `Set`.
* @param ctx Context of `page` * @param ctx Context of `page`
*/ */
getInitialProps?(ctx: NextPageContext): Promise<P> getInitialProps?(ctx: NextPageContext): Promise<IP>
} }
export { NextPageContext, NextComponentType } export { NextPageContext, NextComponentType }
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