diff --git a/types/next/document.d.ts b/types/next/document.d.ts index febd36eb4a..bb0e9ff40f 100644 --- a/types/next/document.d.ts +++ b/types/next/document.d.ts @@ -5,7 +5,7 @@ import { DefaultQuery } from "./router"; export interface RenderPageResponse { buildManifest: Record; html?: string; - head?: Array>; + head?: React.ReactElement[]; } export interface PageProps { @@ -37,7 +37,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?: Array>; + styles?: React.ReactElement[]; } /** diff --git a/types/next/dynamic.d.ts b/types/next/dynamic.d.ts index ebe0d4d9dd..38a85bf77e 100644 --- a/types/next/dynamic.d.ts +++ b/types/next/dynamic.d.ts @@ -7,16 +7,10 @@ import { type Omit = Pick>; -type AsyncComponent

= Promise>; -type AsyncComponentLoader

= () => AsyncComponent

; - -interface ModuleMapping { - [moduleName: string]: AsyncComponent; -} - -interface LoadedModuleMapping { - [moduleName: string]: React.ComponentType; -} +type AsyncComponent

= Promise>; +type AsyncComponentLoader

= () => AsyncComponent

; +type ModuleMapping = Record; +type LoadedModuleMapping = Record; interface NextDynamicOptions

extends Omit { modules?: () => ModuleMapping; // overridden diff --git a/types/next/head.d.ts b/types/next/head.d.ts index d46b371d11..aa86aa5e87 100644 --- a/types/next/head.d.ts +++ b/types/next/head.d.ts @@ -3,6 +3,6 @@ import * as React from "react"; export function defaultHead(): JSX.Element[]; export default class Head extends React.Component { static canUseDOM: boolean; - static peek(): Array>; - static rewind(): Array>; + static peek(): React.ReactElement[]; + static rewind(): React.ReactElement[]; } diff --git a/types/next/test/next-document-tests.tsx b/types/next/test/next-document-tests.tsx index c97201b6f4..d25b340e64 100644 --- a/types/next/test/next-document-tests.tsx +++ b/types/next/test/next-document-tests.tsx @@ -1,4 +1,11 @@ -import Document, { Enhancer, Head, Main, NextScript, NextDocumentContext, PageProps } from 'next/document'; +import Document, { + Enhancer, + Head, + Main, + NextScript, + NextDocumentContext, + PageProps +} from "next/document"; import * as React from "react"; interface WithUrlProps { @@ -11,12 +18,10 @@ class MyDoc extends Document { const _page = renderPage(); // with callback - const enhancer: Enhancer = (App) => (props) => (); + const enhancer: Enhancer = App => props => ; const { html, head, buildManifest } = renderPage(enhancer); - const styles = [ -