Skip to content
Important
Security Advisory: React2Shell & two new vulnerabilities
Find out more

typescript

Last updated April 15, 2025

Configure TypeScript behavior with the typescript option in next.config.js:

next.config.js
module.exports = {
  typescript: {
    ignoreBuildErrors: false,
    tsconfigPath: 'tsconfig.json',
  },
}

Options

OptionTypeDefaultDescription
ignoreBuildErrorsbooleanfalseAllow production builds to complete even with TypeScript errors.
tsconfigPathstring'tsconfig.json'Path to a custom tsconfig.json file.

ignoreBuildErrors

Next.js fails your production build (next build) when TypeScript errors are present in your project.

If you'd like Next.js to dangerously produce production code even when your application has errors, you can disable the built-in type checking step.

If disabled, be sure you are running type checks as part of your build or deploy process, otherwise this can be very dangerous.

next.config.js
module.exports = {
  typescript: {
    // !! WARN !!
    // Dangerously allow production builds to successfully complete even if
    // your project has type errors.
    // !! WARN !!
    ignoreBuildErrors: true,
  },
}

tsconfigPath

Use a different TypeScript configuration file for builds or tooling:

next.config.js
module.exports = {
  typescript: {
    tsconfigPath: 'tsconfig.build.json',
  },
}

See the TypeScript configuration page for more details.

Was this helpful?

supported.