@@ -3,8 +3,6 @@ import { type Help, type ParseOptions } from "commander";
3
3
import {
4
4
type Compiler ,
5
5
type MultiCompiler ,
6
- type MultiStats ,
7
- type Stats ,
8
6
type StatsOptions ,
9
7
type WebpackError ,
10
8
default as webpack ,
@@ -18,7 +16,6 @@ import {
18
16
type BasicPrimitive ,
19
17
type CLIPluginOptions ,
20
18
type CallableWebpackConfiguration ,
21
- type Callback ,
22
19
type CommandAction ,
23
20
type DynamicImport ,
24
21
type EnumValue ,
@@ -29,6 +26,7 @@ import {
29
26
type JsonExt ,
30
27
type LoadableWebpackConfiguration ,
31
28
type ModuleName ,
29
+ type MultiStatsOptions ,
32
30
type PackageInstallOptions ,
33
31
type PackageManager ,
34
32
type Path ,
@@ -50,6 +48,7 @@ import {
50
48
type WebpackCLILogger ,
51
49
type WebpackCLIMainOption ,
52
50
type WebpackCLIOptions ,
51
+ type WebpackCallback ,
53
52
type WebpackCompiler ,
54
53
type WebpackConfiguration ,
55
54
type WebpackDevServerOptions ,
@@ -547,10 +546,7 @@ class WebpackCLI implements IWebpackCLI {
547
546
} ) as WebpackCLICommand ;
548
547
549
548
if ( commandOptions . description ) {
550
- command . description (
551
- commandOptions . description ,
552
- commandOptions . argsDescription as Record < string , string > ,
553
- ) ;
549
+ command . description ( commandOptions . description , commandOptions . argsDescription ! ) ;
554
550
}
555
551
556
552
if ( commandOptions . usage ) {
@@ -2338,7 +2334,7 @@ class WebpackCLI implements IWebpackCLI {
2338
2334
2339
2335
async createCompiler (
2340
2336
options : Partial < WebpackDevServerOptions > ,
2341
- callback ?: Callback < [ Error | undefined , Stats | MultiStats | undefined ] > ,
2337
+ callback ?: WebpackCallback ,
2342
2338
) : Promise < WebpackCompiler > {
2343
2339
if ( typeof options . configNodeEnv === "string" ) {
2344
2340
process . env . NODE_ENV = options . configNodeEnv ;
@@ -2353,7 +2349,7 @@ class WebpackCLI implements IWebpackCLI {
2353
2349
2354
2350
try {
2355
2351
compiler = this . webpack (
2356
- config . options as WebpackConfiguration ,
2352
+ config . options ,
2357
2353
callback
2358
2354
? ( error , stats ) => {
2359
2355
if ( error && this . isValidationError ( error ) ) {
@@ -2399,7 +2395,7 @@ class WebpackCLI implements IWebpackCLI {
2399
2395
createStringifyChunked = jsonExt . stringifyChunked ;
2400
2396
}
2401
2397
2402
- const callback = ( error : Error | undefined , stats : Stats | MultiStats | undefined ) : void => {
2398
+ const callback : WebpackCallback = ( error , stats ) : void => {
2403
2399
if ( error ) {
2404
2400
this . logger . error ( error ) ;
2405
2401
process . exit ( 2 ) ;
@@ -2414,13 +2410,13 @@ class WebpackCLI implements IWebpackCLI {
2414
2410
}
2415
2411
2416
2412
const statsOptions = this . isMultipleCompiler ( compiler )
2417
- ? {
2413
+ ? ( {
2418
2414
children : compiler . compilers . map ( ( compiler ) =>
2419
2415
compiler . options ? compiler . options . stats : undefined ,
2420
2416
) ,
2421
- }
2417
+ } as MultiStatsOptions )
2422
2418
: compiler . options
2423
- ? compiler . options . stats
2419
+ ? ( compiler . options . stats as StatsOptions )
2424
2420
: undefined ;
2425
2421
2426
2422
if ( options . json && createStringifyChunked ) {
0 commit comments