Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Commit

Permalink
Update docs to show how to typecheck next.config.js (vercel#25240)
Browse files Browse the repository at this point in the history
## Documentation

Partially resolves vercel#5318

- [x] Make sure the linting passes
  • Loading branch information
alexbrazier committed May 20, 2021
1 parent 0e922be commit 31b8738
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions docs/basic-features/typescript.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,23 @@ Next.js automatically supports the `tsconfig.json` `"paths"` and `"baseUrl"` opt
You can learn more about this feature on the [Module Path aliases documentation](/docs/advanced-features/module-path-aliases.md).
## Type checking next.config.js
The `next.config.js` file must be a JavaScript file as it does not get parsed by Babel or TypeScript, however you can add some type checking in your IDE using JSDoc as below:
```js
// @ts-check

/**
* @type {import('next/dist/next-server/server/config').NextConfig}
**/
const nextConfig = {
/* config options here */
}

module.exports = nextConfig
```
## Incremental type checking
Since `v10.2.1` Next.js supports [incremental type checking](https://www.typescriptlang.org/tsconfig#incremental) when enabled in your `tsconfig.json`, this can help speed up type checking in larger applications.
Expand Down

0 comments on commit 31b8738

Please sign in to comment.