From 24b20dd13a52ecf602d7ddba5ce01ffba0e8f634 Mon Sep 17 00:00:00 2001 From: Henrik Wenz Date: Mon, 19 Sep 2022 20:15:54 +0200 Subject: [PATCH] chore: Migrate with-prefetching example to typescript (#40671) ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm lint` - [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) --- .../components/{Nav.js => Nav.tsx} | 0 examples/with-prefetching/package.json | 9 +++++++-- .../pages/{_app.js => _app.tsx} | 3 ++- .../pages/{about.js => about.tsx} | 0 .../pages/{contact.js => contact.tsx} | 0 .../pages/{features.js => features.tsx} | 0 .../pages/{index.js => index.tsx} | 0 examples/with-prefetching/tsconfig.json | 20 +++++++++++++++++++ 8 files changed, 29 insertions(+), 3 deletions(-) rename examples/with-prefetching/components/{Nav.js => Nav.tsx} (100%) rename examples/with-prefetching/pages/{_app.js => _app.tsx} (52%) rename examples/with-prefetching/pages/{about.js => about.tsx} (100%) rename examples/with-prefetching/pages/{contact.js => contact.tsx} (100%) rename examples/with-prefetching/pages/{features.js => features.tsx} (100%) rename examples/with-prefetching/pages/{index.js => index.tsx} (100%) create mode 100644 examples/with-prefetching/tsconfig.json diff --git a/examples/with-prefetching/components/Nav.js b/examples/with-prefetching/components/Nav.tsx similarity index 100% rename from examples/with-prefetching/components/Nav.js rename to examples/with-prefetching/components/Nav.tsx diff --git a/examples/with-prefetching/package.json b/examples/with-prefetching/package.json index 349de02f4d84b..8ab7af1a3e0a1 100644 --- a/examples/with-prefetching/package.json +++ b/examples/with-prefetching/package.json @@ -7,7 +7,12 @@ }, "dependencies": { "next": "latest", - "react": "^17.0.2", - "react-dom": "^17.0.2" + "react": "^18.2.0", + "react-dom": "^18.2.0" + }, + "devDependencies": { + "@types/node": "18.7.18", + "@types/react": "18.0.20", + "typescript": "4.8.3" } } diff --git a/examples/with-prefetching/pages/_app.js b/examples/with-prefetching/pages/_app.tsx similarity index 52% rename from examples/with-prefetching/pages/_app.js rename to examples/with-prefetching/pages/_app.tsx index bfcc5a452d248..8e57bb3bd813c 100644 --- a/examples/with-prefetching/pages/_app.js +++ b/examples/with-prefetching/pages/_app.tsx @@ -1,6 +1,7 @@ +import type { AppProps } from 'next/app' import Nav from '../components/Nav' -export default function App({ Component, pageProps }) { +export default function App({ Component, pageProps }: AppProps) { return ( <>