React And Typescript
Edit page
HomeTypeScript Crash Course
Installation
Examples
ContributingReadme

Zeit Next.js

For additional details, please refer to Next.js + Typescript documentation.

1. In an existing, Zeit.js project, install @zeit/next-typescript:

npm install --save @zeit/next-typescript

or

yarn add @zeit/next-typescript

2. Create or edit next.config.js:

// new next.config.js
const withTypescript = require('@zeit/next-typescript');
module.exports = withTypescript();

or

// existing next.config.js
const withTypescript = require('@zeit/next-typescript');
module.exports = withTypescript({
webpack(config, options) {
return config;
},
});

3. Create or edit .babelrc:

{
"presets": ["next/babel", "@zeit/next-typescript/babel"]
}

4. Create a tsconfig.json in the root of your project:

{
"compilerOptions": {
"allowJs": true,
"allowSyntheticDefaultImports": true,
"jsx": "preserve",
"lib": ["dom", "es2017"],
"module": "esnext",
"moduleResolution": "node",
"noEmit": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"preserveConstEnums": true,
"removeComments": false,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "esnext"
}
}