Unverified Commit 7c7e8645 authored by Sebastian Silbermann's avatar Sebastian Silbermann Committed by GitHub

feat(build): Log whether type checking is actually performed (#24440)

Closes https://github.com/vercel/next.js/issues/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.
parent f6c60946
......@@ -183,7 +183,11 @@ export default async function build(
const ignoreTypeScriptErrors = Boolean(config.typescript?.ignoreBuildErrors)
const typeCheckStart = process.hrtime()
const typeCheckingSpinner = createSpinner({
prefixText: `${Log.prefixes.info} Checking validity of types`,
prefixText: `${Log.prefixes.info} ${
ignoreTypeScriptErrors
? 'Skipping validation of types'
: 'Checking validity of types'
}`,
})
const verifyResult = await nextBuildSpan
......@@ -194,15 +198,17 @@ export default async function build(
const typeCheckEnd = process.hrtime(typeCheckStart)
telemetry.record(
eventTypeCheckCompleted({
durationInSeconds: typeCheckEnd[0],
typescriptVersion: verifyResult.version,
inputFilesCount: verifyResult.result?.inputFilesCount,
totalFilesCount: verifyResult.result?.totalFilesCount,
incremental: verifyResult.result?.incremental,
})
)
if (!ignoreTypeScriptErrors) {
telemetry.record(
eventTypeCheckCompleted({
durationInSeconds: typeCheckEnd[0],
typescriptVersion: verifyResult.version,
inputFilesCount: verifyResult.result?.inputFilesCount,
totalFilesCount: verifyResult.result?.totalFilesCount,
incremental: verifyResult.result?.incremental,
})
)
}
if (typeCheckingSpinner) {
typeCheckingSpinner.stopAndPersist()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment