Commit 68e3223c authored by Adam Misiorny's avatar Adam Misiorny Committed by Luis Fernando Alvarez D

Improve type definitions (#8117)

parent 8243af25
......@@ -215,7 +215,7 @@ export async function loadGetInitialProps<
C extends BaseContext,
IP = {},
P = {}
>(Component: NextComponentType<C, IP, P>, ctx: C): Promise<IP | null> {
>(Component: NextComponentType<C, IP, P>, ctx: C): Promise<IP> {
if (process.env.NODE_ENV !== 'production') {
if (Component.prototype && Component.prototype.getInitialProps) {
const message = `"${getDisplayName(
......
......@@ -38,7 +38,9 @@ declare module 'react' {
* `Page` type, use it as a guide to create `pages`.
*/
export type NextPage<P = {}, IP = P> = {
(props: P): JSX.Element
(props: P): JSX.Element | null
defaultProps?: Partial<P>
displayName?: string
/**
* 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`.
......
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