Skip to content

Commit 0162911

Browse files
Josehowerijjk
andauthored
Fix Type to solve issue found in #36008 (#36671)
* Fix Type to solve issue found in #36008 It seems the types inside of `DocumentInitialProps` have inconsistencies with the type coming from a fragment The issue is documented here #36008 * Add test Co-authored-by: JJ Kasper <jj@jjsweb.site>
1 parent 88747a2 commit 0162911

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed
Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,26 @@
1-
import { Html, Head, Main, NextScript } from 'next/document'
1+
import Document, { Html, Head, Main, NextScript } from 'next/document'
22

3-
export default function Document() {
4-
return (
5-
<Html>
6-
<Head>
7-
<meta property="og:url" content="https://nextjs.org/docs" />
8-
<meta name="theme-color" content="#ffffff" />
9-
</Head>
10-
<body>
11-
<Main />
12-
<NextScript />
13-
</body>
14-
</Html>
15-
)
3+
export default class MyDocument extends Document {
4+
static async getInitialProps(ctx) {
5+
const initialProps = await Document.getInitialProps(ctx)
6+
return {
7+
...initialProps,
8+
styles: <></>,
9+
}
10+
}
11+
12+
render() {
13+
return (
14+
<Html>
15+
<Head>
16+
<meta property="og:url" content="https://nextjs.org/docs" />
17+
<meta name="theme-color" content="#ffffff" />
18+
</Head>
19+
<body>
20+
<Main />
21+
<NextScript />
22+
</body>
23+
</Html>
24+
)
25+
}
1626
}

0 commit comments

Comments
 (0)