Path aliases and baseUrl
Next.js automatically supports the tsconfig.json "paths" and "baseUrl" options.
You can learn more about this feature on the Module Path aliases documentation.
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:
 // @ts-check
 
/**
 * @type {import('next').NextConfig}
 **/
const nextConfig = {
  /* config options here */
}
 
module.exports = nextConfig
Incremental type checking
Since v10.2.1 Next.js supports incremental type checking when enabled in your tsconfig.json, this can help speed up type checking in larger applications.
Ignoring TypeScript Errors
Next.js fails your production build (next build) when TypeScript errors are present in your project.