From afe7c8ecd8f2d5b80c31e9791346ab1bcde03c7e Mon Sep 17 00:00:00 2001 From: martinfrancois Date: Sat, 8 Aug 2026 02:45:34 +0200 Subject: [PATCH] Remove unused `hasWarnings` and `warnings` Nothing reads these two fields on `TypeCheckResult`. `verifyAndRunTypeScript` has four callers: - `build/type-check.ts` reads only `inputFilesCount`, `totalFilesCount` and `incremental` - `next-test` reads only `version` - `setup-dev-bundler` reads only `version` - `next-typegen` throws the result away `warnings` is also always empty. It looks for diagnostics with the category `Warning`, but I checked, TypeScript 6.0.2 has no messages in that category. Deprecation messages use `Suggestion` instead. So on every build we filtered and formatted every diagnostic to build a list that was always empty, and that nobody read. --- packages/next/src/lib/typescript/runTypeCheck.ts | 11 ----------- packages/next/src/lib/typescript/runTypeCheckCli.ts | 1 - 2 files changed, 12 deletions(-) diff --git a/packages/next/src/lib/typescript/runTypeCheck.ts b/packages/next/src/lib/typescript/runTypeCheck.ts index 56462a875037..9d97f59146fc 100644 --- a/packages/next/src/lib/typescript/runTypeCheck.ts +++ b/packages/next/src/lib/typescript/runTypeCheck.ts @@ -8,8 +8,6 @@ import { CompileError } from '../compile-error' import { warn } from '../../build/output/log' export interface TypeCheckResult { - hasWarnings: boolean - warnings?: string[] inputFilesCount?: number totalFilesCount?: number incremental: boolean @@ -108,7 +106,6 @@ export async function runTypeCheck( if (fileNames.length < 1) { return { - hasWarnings: false, inputFilesCount: 0, totalFilesCount: 0, incremental: false, @@ -214,15 +211,7 @@ export async function runTypeCheck( ) } - const warnings = allDiagnostics - .filter((d) => d.category === typescript.DiagnosticCategory.Warning) - .map((d) => - getFormattedDiagnostic(typescript, baseDir, distDir, d, isAppDirEnabled) - ) - return { - hasWarnings: true, - warnings, inputFilesCount: fileNames.length, totalFilesCount: program.getSourceFiles().length, incremental, diff --git a/packages/next/src/lib/typescript/runTypeCheckCli.ts b/packages/next/src/lib/typescript/runTypeCheckCli.ts index 75258d3369f6..1abdb7f37685 100644 --- a/packages/next/src/lib/typescript/runTypeCheckCli.ts +++ b/packages/next/src/lib/typescript/runTypeCheckCli.ts @@ -59,7 +59,6 @@ export async function runTypeCheckCli({ } return { - hasWarnings: false, incremental, } }