Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert with-app-layout example to TypeScript #42930

Merged
merged 2 commits into from Nov 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/with-app-layout/README.md
@@ -1,6 +1,6 @@
# With `App` layout example

Shows how to use \_app.js to implement a global layout for all pages.
Shows how to use `_app.tsx` to implement a global layout for all pages.

## Deploy your own

Expand Down
6 changes: 6 additions & 0 deletions examples/with-app-layout/package.json
Expand Up @@ -9,5 +9,11 @@
"next": "latest",
"react": "^18.2.0",
"react-dom": "^18.2.0"
},
"devDependencies": {
"@types/node": "^18.11.9",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"typescript": "^4.8.4"
}
}
9 changes: 0 additions & 9 deletions examples/with-app-layout/pages/_app.js

This file was deleted.

17 changes: 17 additions & 0 deletions examples/with-app-layout/pages/_app.tsx
@@ -0,0 +1,17 @@
import type { AppProps } from 'next/app'

interface LayoutProps {
children: React.ReactNode
}

const Layout = ({ children }: LayoutProps) => (
<div className="layout">{children}</div>
)

export default function App({ Component, pageProps }: AppProps) {
return (
<Layout>
<Component {...pageProps} />
</Layout>
)
}
20 changes: 20 additions & 0 deletions examples/with-app-layout/tsconfig.json
@@ -0,0 +1,20 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": false,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
"exclude": ["node_modules"]
}