diff --git a/docs/basic-features/typescript.md b/docs/basic-features/typescript.md index 2bd00ec2718b2..c4c67789ac173 100644 --- a/docs/basic-features/typescript.md +++ b/docs/basic-features/typescript.md @@ -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.