diff --git a/packages/next/document.d.ts b/packages/next/document.d.ts index 5791152a482e..30a1ca701f3f 100644 --- a/packages/next/document.d.ts +++ b/packages/next/document.d.ts @@ -1,3 +1,3 @@ -import Document from './dist/shared/lib/runtime-config' +import Document from './dist/pages/_document' export * from './dist/pages/_document' export default Document diff --git a/test/integration/typescript/pages/_app.tsx b/test/integration/typescript/pages/_app.tsx new file mode 100644 index 000000000000..bc26412e55da --- /dev/null +++ b/test/integration/typescript/pages/_app.tsx @@ -0,0 +1,20 @@ +// import App from "next/app"; +import type { AppProps /*, AppContext */ } from 'next/app' + +function MyApp({ Component, pageProps }: AppProps) { + return +} + +// Only uncomment this method if you have blocking data requirements for +// every single page in your application. This disables the ability to +// perform automatic static optimization, causing every page in your app to +// be server-side rendered. +// +// MyApp.getInitialProps = async (appContext: AppContext) => { +// // calls page's `getInitialProps` and fills `appProps.pageProps` +// const appProps = await App.getInitialProps(appContext); + +// return { ...appProps } +// } + +export default MyApp diff --git a/test/integration/typescript/pages/_document.tsx b/test/integration/typescript/pages/_document.tsx new file mode 100644 index 000000000000..430ef95b125e --- /dev/null +++ b/test/integration/typescript/pages/_document.tsx @@ -0,0 +1,11 @@ +import Document, { DocumentContext } from 'next/document' + +class MyDocument extends Document { + static async getInitialProps(ctx: DocumentContext) { + const initialProps = await Document.getInitialProps(ctx) + + return initialProps + } +} + +export default MyDocument