@@ -182,7 +182,7 @@ const AUTO_FOR_TO_STRING = ({ all }, { forToString }) => {
182182/** @typedef {keyof NormalizedStatsOptions } DefaultsKeys */
183183/** @typedef {{ [Key in DefaultsKeys]: (options: Partial<NormalizedStatsOptions>, context: CreateStatsOptionsContext, compilation: Compilation) => NormalizedStatsOptions[Key] | RequestShortener } } Defaults */
184184
185- /** @type {Partial< Defaults> } */
185+ /** @type {Defaults } */
186186const DEFAULTS = {
187187 context : ( options , context , compilation ) => compilation . compiler . context ,
188188 requestShortener : ( options , context , compilation ) =>
@@ -307,9 +307,9 @@ const normalizeFilter = item => {
307307} ;
308308
309309/** @typedef {keyof (KnownNormalizedStatsOptions | StatsOptions) } NormalizerKeys */
310- /** @typedef {{ [Key in NormalizerKeys]: (value: StatsOptions[Key]) => KnownNormalizedStatsOptions[Key] } } Normalizers */
310+ /** @typedef {{ [Key in NormalizerKeys]? : (value: StatsOptions[Key]) => KnownNormalizedStatsOptions[Key] } } Normalizers */
311311
312- /** @type {Partial< Normalizers> } */
312+ /** @type {Normalizers } */
313313const NORMALIZER = {
314314 excludeModules : value => {
315315 if ( ! Array . isArray ( value ) ) {
@@ -391,18 +391,16 @@ class DefaultStatsPresetPlugin {
391391 compilation . hooks . statsNormalize . tap ( PLUGIN_NAME , ( options , context ) => {
392392 for ( const key of Object . keys ( DEFAULTS ) ) {
393393 if ( options [ key ] === undefined ) {
394- options [ key ] =
395- /** @type {Defaults[DefaultsKeys] } */
396- ( DEFAULTS [ /** @type {DefaultsKeys } */ ( key ) ] ) (
397- options ,
398- context ,
399- compilation
400- ) ;
394+ options [ key ] = DEFAULTS [ /** @type {DefaultsKeys } */ ( key ) ] (
395+ options ,
396+ context ,
397+ compilation
398+ ) ;
401399 }
402400 }
403401 for ( const key of Object . keys ( NORMALIZER ) ) {
404402 options [ key ] =
405- /** @type {TODO } */
403+ /** @type {NonNullable<Normalizers[keyof Normalizers]> } */
406404 ( NORMALIZER [ /** @type {NormalizerKeys } */ ( key ) ] ) ( options [ key ] ) ;
407405 }
408406 } ) ;
0 commit comments