From c1a09471ff20363d3446686ab8b234911827d30f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Burzy=C5=84ski?= Date: Tue, 24 Aug 2021 16:08:18 +0200 Subject: [PATCH] Add missing `typescript` property to `NextConfig` (#28459) This is similar to https://github.com/vercel/next.js/pull/27126 , https://github.com/vercel/next.js/pull/27446 and https://github.com/vercel/next.js/pull/27974 ## Bug - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Errors have helpful link attached, see `contributing.md` ## Feature - [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR. - [ ] Related issues linked using `fixes #number` - [ ] Integration tests added - [ ] Documentation added - [ ] Telemetry added. In case of a feature if it's used or not. - [ ] Errors have helpful link attached, see `contributing.md` ## Documentation / Examples - [x] Make sure the linting passes --- packages/next/build/index.ts | 4 ++-- packages/next/server/config-shared.ts | 12 ++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/next/build/index.ts b/packages/next/build/index.ts index 061b19351fe1a..cf26b1dfcd9fe 100644 --- a/packages/next/build/index.ts +++ b/packages/next/build/index.ts @@ -176,7 +176,7 @@ export default async function build( telemetry.record(events) ) - const ignoreTypeScriptErrors = Boolean(config.typescript?.ignoreBuildErrors) + const ignoreTypeScriptErrors = Boolean(config.typescript.ignoreBuildErrors) const typeCheckStart = process.hrtime() const typeCheckingSpinner = createSpinner({ prefixText: `${Log.prefixes.info} ${ @@ -216,7 +216,7 @@ export default async function build( typeCheckingSpinner.stopAndPersist() } - const ignoreESLint = Boolean(config.eslint?.ignoreDuringBuilds) + const ignoreESLint = Boolean(config.eslint.ignoreDuringBuilds) const eslintCacheDir = path.join(cacheDir, 'eslint/') if (!ignoreESLint && runLint) { await nextBuildSpan diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 48d577978e2f3..d62edf36c62bf 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -29,10 +29,16 @@ export interface ESLintConfig { ignoreDuringBuilds?: boolean } +export interface TypeScriptConfig { + /** Do not run TypeScript during production builds (`next build`). */ + ignoreBuildErrors?: boolean +} + export type NextConfig = { [key: string]: any } & { i18n?: I18NConfig | null eslint?: ESLintConfig + typescript?: TypeScriptConfig headers?: () => Promise rewrites?: () => Promise< @@ -139,6 +145,12 @@ export const defaultConfig: NextConfig = { env: {}, webpack: null, webpackDevMiddleware: null, + eslint: { + ignoreDuringBuilds: false, + }, + typescript: { + ignoreBuildErrors: false, + }, distDir: '.next', cleanDistDir: true, assetPrefix: '',