Skip to content

Commit 7c7e864

Browse files
authored
feat(build): Log whether type checking is actually performed (vercel#24440)
Closes vercel#24889 ## Feature Currently `next build` is logging "Checking validity of types" even if `typescript.ignoreBuildErrors` is `true`. It seems like these options still work so `next build` either shouldn't log anything related to type-checking or log that type-checking is skipped. I decided to branch the log message for clarity. Happy to add a test but I'm not sure if you have existing infra considering https://github.com/vercel/next.js/pull/23226/files (which added the message) didn't add or change tests either. CI failures look unrelated to me.
1 parent f6c6094 commit 7c7e864

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

packages/next/build/index.ts

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,11 @@ export default async function build(
183183
const ignoreTypeScriptErrors = Boolean(config.typescript?.ignoreBuildErrors)
184184
const typeCheckStart = process.hrtime()
185185
const typeCheckingSpinner = createSpinner({
186-
prefixText: `${Log.prefixes.info} Checking validity of types`,
186+
prefixText: `${Log.prefixes.info} ${
187+
ignoreTypeScriptErrors
188+
? 'Skipping validation of types'
189+
: 'Checking validity of types'
190+
}`,
187191
})
188192

189193
const verifyResult = await nextBuildSpan
@@ -194,15 +198,17 @@ export default async function build(
194198

195199
const typeCheckEnd = process.hrtime(typeCheckStart)
196200

197-
telemetry.record(
198-
eventTypeCheckCompleted({
199-
durationInSeconds: typeCheckEnd[0],
200-
typescriptVersion: verifyResult.version,
201-
inputFilesCount: verifyResult.result?.inputFilesCount,
202-
totalFilesCount: verifyResult.result?.totalFilesCount,
203-
incremental: verifyResult.result?.incremental,
204-
})
205-
)
201+
if (!ignoreTypeScriptErrors) {
202+
telemetry.record(
203+
eventTypeCheckCompleted({
204+
durationInSeconds: typeCheckEnd[0],
205+
typescriptVersion: verifyResult.version,
206+
inputFilesCount: verifyResult.result?.inputFilesCount,
207+
totalFilesCount: verifyResult.result?.totalFilesCount,
208+
incremental: verifyResult.result?.incremental,
209+
})
210+
)
211+
}
206212

207213
if (typeCheckingSpinner) {
208214
typeCheckingSpinner.stopAndPersist()

0 commit comments

Comments
 (0)