Commit f8b56da7 authored by Joe Haddad's avatar Joe Haddad Committed by kodiakhq[bot]

Revert "Improve type definitions" (#8098)

Reverts zeit/next.js#8097

This PR caused bundle sizes to increase. We need to fix this bug before we continue adding invalid TypeScript exports to our code.
parent d006a24d
...@@ -215,7 +215,7 @@ export async function loadGetInitialProps< ...@@ -215,7 +215,7 @@ export async function loadGetInitialProps<
C extends BaseContext, C extends BaseContext,
IP = {}, IP = {},
P = {} P = {}
>(Component: NextComponentType<C, IP, P>, ctx: C): Promise<IP> { >(Component: NextComponentType<C, IP, P>, ctx: C): Promise<IP | null> {
if (process.env.NODE_ENV !== 'production') { if (process.env.NODE_ENV !== 'production') {
if (Component.prototype && Component.prototype.getInitialProps) { if (Component.prototype && Component.prototype.getInitialProps) {
const message = `"${getDisplayName( const message = `"${getDisplayName(
......
...@@ -112,7 +112,7 @@ function getRouter() { ...@@ -112,7 +112,7 @@ function getRouter() {
export default singletonRouter as SingletonRouter export default singletonRouter as SingletonRouter
// Reexport the withRoute HOC // Reexport the withRoute HOC
export { default as withRouter, WithRouterProps } from './with-router' export { default as withRouter } from './with-router'
export function useRouter() { export function useRouter() {
return React.useContext(RouterContext) return React.useContext(RouterContext)
......
...@@ -38,9 +38,7 @@ declare module 'react' { ...@@ -38,9 +38,7 @@ 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 = {}, IP = P> = { export type NextPage<P = {}, IP = P> = {
(props: P): JSX.Element | null (props: P): JSX.Element
defaultProps?: Partial<P>
displayName?: string
/** /**
* 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`.
......
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