diff --git a/types/next/document.d.ts b/types/next/document.d.ts index d0e6d2c91b..f89e5d71e0 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -2,10 +2,15 @@ import * as React from "react"; import { NextContext, NextComponentType } from "."; import { DefaultQuery } from "./router"; +/** + * Result from renderPage(). + * https://github.com/zeit/next.js/blob/v8.0.0/packages/next/pages/_document.js#L18 + * https://github.com/zeit/next.js/blob/v8.0.0/packages/next-server/server/render.tsx#L159 + * https://github.com/zeit/next.js/blob/v8.0.0/packages/next-server/server/render.tsx#L44 + */ export interface RenderPageResponse { - buildManifest: Record; html?: string; - head?: Array>; + head?: React.ReactNode; } export interface PageProps { @@ -31,7 +36,7 @@ export interface NextDocumentContext exte E extends PageProps = AnyPageProps, P = E, EA extends PageProps = AnyPageProps, - PA = EA, + PA = EA >( enhancer?: | Enhancer // tslint:disable-line no-unnecessary-generics @@ -44,7 +49,7 @@ export interface NextDocumentContext exte * https://github.com/zeit/next.js/blob/7.0.0/server/document.js#L16 */ export interface DefaultDocumentIProps extends RenderPageResponse { - styles?: React.ReactNode[]; + styles?: React.ReactNode; } /** diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 8d911ab2c1..73d3d70800 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for next 7.0 +// Type definitions for next 8.0 // Project: https://github.com/zeit/next.js/packages/next // Definitions by: Drew Hays // Brice BERNARD diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index 1cd217a749..7c50a03930 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -48,19 +48,24 @@ class MyDoc extends Document { // with app and component enhancers const enhanceApp: Enhancer = App => props => ; const enhanceComponent: Enhancer = Component => props => ; - const { html, head, buildManifest } = renderPage({ + const { html, head } = renderPage({ enhanceApp, enhanceComponent }); const initialProps = await Document.getInitialProps(ctx); - const styles = [...(initialProps.styles ? initialProps.styles : []),