Skip to content

Commit fb8ba1d

Browse files
authoredJan 22, 2024
[examples] Fix build on Next.js Pages Router examples (mui#40665)
1 parent 1700e5c commit fb8ba1d

File tree

5 files changed

+15
-13
lines changed

5 files changed

+15
-13
lines changed
 

‎examples/joy-ui-nextjs-ts/src/components/ThemeRegistry/EmotionCache.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,7 @@ export type NextAppDirEmotionCacheProviderProps = {
99
/** This is the options passed to createCache() from 'import createCache from "@emotion/cache"' */
1010
options: Omit<OptionsOfCreateCache, 'insertionPoint'>;
1111
/** By default <CacheProvider /> from 'import { CacheProvider } from "@emotion/react"' */
12-
CacheProvider?: (props: {
13-
value: EmotionCache;
14-
children: React.ReactNode;
15-
}) => React.JSX.Element | null;
12+
CacheProvider?: React.ElementType<{ value: EmotionCache }>;
1613
children: React.ReactNode;
1714
};
1815

‎examples/material-ui-nextjs-pages-router-ts/pages/_document.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import * as React from 'react';
22
import { Html, Head, Main, NextScript, DocumentProps, DocumentContext } from 'next/document';
3-
import { DocumentHeadTags, documentGetInitialProps } from '@mui/material-nextjs/v14-pagesRouter';
3+
import {
4+
DocumentHeadTags,
5+
DocumentHeadTagsProps,
6+
documentGetInitialProps,
7+
} from '@mui/material-nextjs/v14-pagesRouter';
48
import theme, { roboto } from '../src/theme';
59

6-
export default function MyDocument(props: DocumentProps) {
10+
export default function MyDocument(props: DocumentProps & DocumentHeadTagsProps) {
711
return (
812
<Html lang="en" className={roboto.className}>
913
<Head>

‎examples/material-ui-nextjs-ts-v4-v5-migration/pages/_document.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ import {
99
DocumentContext,
1010
} from 'next/document';
1111
import { AppProps } from 'next/app';
12-
import { DocumentHeadTags, documentGetInitialProps } from '@mui/material-nextjs/v14-pagesRouter';
12+
import {
13+
DocumentHeadTags,
14+
DocumentHeadTagsProps,
15+
documentGetInitialProps,
16+
} from '@mui/material-nextjs/v14-pagesRouter';
1317
import { ServerStyleSheets as JSSServerStyleSheets } from '@mui/styles';
1418
import theme from '../src/theme';
1519

16-
export default function MyDocument(props: DocumentProps) {
20+
export default function MyDocument(props: DocumentProps & DocumentHeadTagsProps) {
1721
return (
1822
<Html lang="en">
1923
<Head>

‎packages/mui-material-nextjs/src/v13-appRouter/appRouterV13.tsx

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ export type AppRouterCacheProviderProps = {
1818
/**
1919
* By default <CacheProvider /> from 'import { CacheProvider } from "@emotion/react"'.
2020
*/
21-
CacheProvider?: (props: {
22-
value: EmotionCache;
23-
children: React.ReactNode;
24-
}) => React.JSX.Element | null;
21+
CacheProvider?: React.ElementType<{ value: EmotionCache }>;
2522
children: React.ReactNode;
2623
};
2724

‎packages/mui-material-nextjs/src/v13-pagesRouter/pagesRouterV13Document.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export function createGetInitialProps(plugins: Plugin[]) {
3737
}
3838

3939
export interface DocumentHeadTagsProps {
40-
emotionStyleTags: React.JSX.Element[];
40+
emotionStyleTags: React.ReactElement[];
4141
}
4242

4343
export function DocumentHeadTags(props: DocumentHeadTagsProps) {

0 commit comments

Comments
 (0)
Please sign in to comment.