@@ -3,8 +3,6 @@ import { type Help, type ParseOptions } from "commander";
33import {
44 type Compiler ,
55 type MultiCompiler ,
6- type MultiStats ,
7- type Stats ,
86 type StatsOptions ,
97 type WebpackError ,
108 default as webpack ,
@@ -18,7 +16,6 @@ import {
1816 type BasicPrimitive ,
1917 type CLIPluginOptions ,
2018 type CallableWebpackConfiguration ,
21- type Callback ,
2219 type CommandAction ,
2320 type DynamicImport ,
2421 type EnumValue ,
@@ -29,6 +26,7 @@ import {
2926 type JsonExt ,
3027 type LoadableWebpackConfiguration ,
3128 type ModuleName ,
29+ type MultiStatsOptions ,
3230 type PackageInstallOptions ,
3331 type PackageManager ,
3432 type Path ,
@@ -50,6 +48,7 @@ import {
5048 type WebpackCLILogger ,
5149 type WebpackCLIMainOption ,
5250 type WebpackCLIOptions ,
51+ type WebpackCallback ,
5352 type WebpackCompiler ,
5453 type WebpackConfiguration ,
5554 type WebpackDevServerOptions ,
@@ -547,10 +546,7 @@ class WebpackCLI implements IWebpackCLI {
547546 } ) as WebpackCLICommand ;
548547
549548 if ( commandOptions . description ) {
550- command . description (
551- commandOptions . description ,
552- commandOptions . argsDescription as Record < string , string > ,
553- ) ;
549+ command . description ( commandOptions . description , commandOptions . argsDescription ! ) ;
554550 }
555551
556552 if ( commandOptions . usage ) {
@@ -2338,7 +2334,7 @@ class WebpackCLI implements IWebpackCLI {
23382334
23392335 async createCompiler (
23402336 options : Partial < WebpackDevServerOptions > ,
2341- callback ?: Callback < [ Error | undefined , Stats | MultiStats | undefined ] > ,
2337+ callback ?: WebpackCallback ,
23422338 ) : Promise < WebpackCompiler > {
23432339 if ( typeof options . configNodeEnv === "string" ) {
23442340 process . env . NODE_ENV = options . configNodeEnv ;
@@ -2353,7 +2349,7 @@ class WebpackCLI implements IWebpackCLI {
23532349
23542350 try {
23552351 compiler = this . webpack (
2356- config . options as WebpackConfiguration ,
2352+ config . options ,
23572353 callback
23582354 ? ( error , stats ) => {
23592355 if ( error && this . isValidationError ( error ) ) {
@@ -2399,7 +2395,7 @@ class WebpackCLI implements IWebpackCLI {
23992395 createStringifyChunked = jsonExt . stringifyChunked ;
24002396 }
24012397
2402- const callback = ( error : Error | undefined , stats : Stats | MultiStats | undefined ) : void => {
2398+ const callback : WebpackCallback = ( error , stats ) : void => {
24032399 if ( error ) {
24042400 this . logger . error ( error ) ;
24052401 process . exit ( 2 ) ;
@@ -2414,13 +2410,13 @@ class WebpackCLI implements IWebpackCLI {
24142410 }
24152411
24162412 const statsOptions = this . isMultipleCompiler ( compiler )
2417- ? {
2413+ ? ( {
24182414 children : compiler . compilers . map ( ( compiler ) =>
24192415 compiler . options ? compiler . options . stats : undefined ,
24202416 ) ,
2421- }
2417+ } as MultiStatsOptions )
24222418 : compiler . options
2423- ? compiler . options . stats
2419+ ? ( compiler . options . stats as StatsOptions )
24242420 : undefined ;
24252421
24262422 if ( options . json && createStringifyChunked ) {
0 commit comments