Skip to content

Commit 508877c

Browse files
authored
Merge pull request #15050 from luffy84217/fix-callback-err-type-should-include-null
fix callback err type should include null
2 parents 4ed40f9 + f0a8664 commit 508877c

33 files changed

Lines changed: 110 additions & 97 deletions

‎lib/Cache.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const {
2121
/**
2222
* @template T
2323
* @callback CallbackCache
24-
* @param {WebpackError=} err
24+
* @param {(WebpackError | null)=} err
2525
* @param {T=} result
2626
* @returns {void}
2727
*/

‎lib/CacheFacade.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@ const mergeEtags = require("./cache/mergeEtags");
1919
/**
2020
* @template T
2121
* @callback CallbackCache
22-
* @param {WebpackError=} err
22+
* @param {(WebpackError | null)=} err
2323
* @param {T=} result
2424
* @returns {void}
2525
*/
2626

2727
/**
2828
* @template T
2929
* @callback CallbackNormalErrorCache
30-
* @param {Error=} err
30+
* @param {(Error | null)=} err
3131
* @param {T=} result
3232
* @returns {void}
3333
*/

‎lib/CleanPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const validate = createSchemaValidation(
4545
* @param {OutputFileSystem} fs filesystem
4646
* @param {string} outputPath output path
4747
* @param {Set<string>} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator)
48-
* @param {function(Error=, Set<string>=): void} callback returns the filenames of the assets that shouldn't be there
48+
* @param {function((Error | null)=, Set<string>=): void} callback returns the filenames of the assets that shouldn't be there
4949
* @returns {void}
5050
*/
5151
const getDiffToFs = (fs, outputPath, currentAssets, callback) => {

‎lib/Compilation.js‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -116,34 +116,34 @@ const { isSourceEqual } = require("./util/source");
116116

117117
/**
118118
* @callback Callback
119-
* @param {WebpackError=} err
119+
* @param {(WebpackError | null)=} err
120120
* @returns {void}
121121
*/
122122

123123
/**
124124
* @callback ModuleCallback
125-
* @param {WebpackError=} err
125+
* @param {(WebpackError | null)=} err
126126
* @param {Module=} result
127127
* @returns {void}
128128
*/
129129

130130
/**
131131
* @callback ModuleFactoryResultCallback
132-
* @param {WebpackError=} err
132+
* @param {(WebpackError | null)=} err
133133
* @param {ModuleFactoryResult=} result
134134
* @returns {void}
135135
*/
136136

137137
/**
138138
* @callback ModuleOrFactoryResultCallback
139-
* @param {WebpackError=} err
139+
* @param {(WebpackError | null)=} err
140140
* @param {Module | ModuleFactoryResult=} result
141141
* @returns {void}
142142
*/
143143

144144
/**
145145
* @callback ExecuteModuleCallback
146-
* @param {WebpackError=} err
146+
* @param {(WebpackError | null)=} err
147147
* @param {ExecuteModuleResult=} result
148148
* @returns {void}
149149
*/

‎lib/Compiler.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ const { isSourceEqual } = require("./util/source");
5858
/**
5959
* @template T
6060
* @callback Callback
61-
* @param {Error=} err
61+
* @param {(Error | null)=} err
6262
* @param {T=} result
6363
*/
6464

6565
/**
6666
* @callback RunAsChildCallback
67-
* @param {Error=} err
67+
* @param {(Error | null)=} err
6868
* @param {Chunk[]=} entries
6969
* @param {Compilation=} compilation
7070
*/

‎lib/ContextModule.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ const makeSerializable = require("./util/makeSerializable");
7171

7272
/**
7373
* @callback ResolveDependenciesCallback
74-
* @param {Error=} err
74+
* @param {(Error | null)=} err
7575
* @param {ContextElementDependency[]=} dependencies
7676
*/
7777

@@ -315,7 +315,7 @@ class ContextModule extends Module {
315315

316316
/**
317317
* @param {NeedBuildContext} context context info
318-
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
318+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
319319
* @returns {void}
320320
*/
321321
needBuild({ fileSystemInfo }, callback) {

‎lib/DelegatedModule.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ class DelegatedModule extends Module {
9191

9292
/**
9393
* @param {NeedBuildContext} context context info
94-
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
94+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
9595
* @returns {void}
9696
*/
9797
needBuild(context, callback) {

‎lib/DllModule.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class DllModule extends Module {
9696

9797
/**
9898
* @param {NeedBuildContext} context context info
99-
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
99+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
100100
* @returns {void}
101101
*/
102102
needBuild(context, callback) {

‎lib/ExternalModule.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ class ExternalModule extends Module {
432432

433433
/**
434434
* @param {NeedBuildContext} context context info
435-
* @param {function(WebpackError=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
435+
* @param {function((WebpackError | null)=, boolean=): void} callback callback function, returns true, if the module needs a rebuild
436436
* @returns {void}
437437
*/
438438
needBuild(context, callback) {

‎lib/ExternalModuleFactoryPlugin.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class ExternalModuleFactoryPlugin {
117117

118118
/**
119119
* @param {Externals} externals externals config
120-
* @param {function(Error=, ExternalModule=): void} callback callback
120+
* @param {function((Error | null)=, ExternalModule=): void} callback callback
121121
* @returns {void}
122122
*/
123123
const handleExternals = (externals, callback) => {

0 commit comments

Comments
 (0)