diff --git a/packages/rspack/src/executors/rspack/rspack.impl.ts b/packages/rspack/src/executors/rspack/rspack.impl.ts index b42001f319..126ae14e76 100644 --- a/packages/rspack/src/executors/rspack/rspack.impl.ts +++ b/packages/rspack/src/executors/rspack/rspack.impl.ts @@ -30,7 +30,7 @@ export default async function* runExecutor( normalizedOptions.mode = process.env.NODE_ENV; } - if (normalizedOptions.typeCheck) { + if (!normalizedOptions.skipTypeChecking) { await executeTypeCheck(normalizedOptions, context); } diff --git a/packages/rspack/src/plugins/utils/plugins/normalize-options.ts b/packages/rspack/src/plugins/utils/plugins/normalize-options.ts index c1e9038eb6..13cd39ab3f 100644 --- a/packages/rspack/src/plugins/utils/plugins/normalize-options.ts +++ b/packages/rspack/src/plugins/utils/plugins/normalize-options.ts @@ -82,6 +82,37 @@ export function normalizeOptions( ); } + // Normalize typeCheck and skipTypeChecking options + let normalizedTypeCheck: boolean; + let normalizedSkipTypeChecking: boolean; + + if ( + combinedPluginAndMaybeExecutorOptions.typeCheck !== undefined && + combinedPluginAndMaybeExecutorOptions.skipTypeChecking !== undefined + ) { + // Both options are provided - use typeCheck as the source of truth + normalizedTypeCheck = combinedPluginAndMaybeExecutorOptions.typeCheck; + normalizedSkipTypeChecking = + !combinedPluginAndMaybeExecutorOptions.typeCheck; + } else if (combinedPluginAndMaybeExecutorOptions.typeCheck !== undefined) { + // Only typeCheck is provided + normalizedTypeCheck = combinedPluginAndMaybeExecutorOptions.typeCheck; + normalizedSkipTypeChecking = + !combinedPluginAndMaybeExecutorOptions.typeCheck; + } else if ( + combinedPluginAndMaybeExecutorOptions.skipTypeChecking !== undefined + ) { + // Only skipTypeChecking is provided + normalizedSkipTypeChecking = + combinedPluginAndMaybeExecutorOptions.skipTypeChecking; + normalizedTypeCheck = + !combinedPluginAndMaybeExecutorOptions.skipTypeChecking; + } else { + // Neither option is provided - use defaults + normalizedTypeCheck = true; + normalizedSkipTypeChecking = false; + } + return { ...combinedPluginAndMaybeExecutorOptions, assets: combinedPluginAndMaybeExecutorOptions.assets @@ -126,6 +157,7 @@ export function normalizeOptions( combinedPluginAndMaybeExecutorOptions.sassImplementation ?? 'sass-embedded', scripts: combinedPluginAndMaybeExecutorOptions.scripts ?? [], + skipTypeChecking: normalizedSkipTypeChecking, sourceMap: combinedPluginAndMaybeExecutorOptions.sourceMap ?? !isProd, sourceRoot, styles: combinedPluginAndMaybeExecutorOptions.styles ?? [], @@ -133,6 +165,7 @@ export function normalizeOptions( combinedPluginAndMaybeExecutorOptions.subresourceIntegrity ?? false, target: combinedPluginAndMaybeExecutorOptions.target ?? 'web', targetName, + typeCheck: normalizedTypeCheck, vendorChunk: combinedPluginAndMaybeExecutorOptions.vendorChunk ?? !isProd, }; }