@@ -130,9 +130,9 @@ const deprecatedNeedRebuild = util.deprecate(
130130
131131class Module extends DependenciesBlock {
132132 /**
133- * @param {ModuleTypes } type the module type, when deserializing the type is not known and is an empty string
134- * @param {string= } context an optional context
135- * @param {string= } layer an optional layer in which the module is
133+ * @param {ModuleTypes | "" } type the module type, when deserializing the type is not known and is an empty string
134+ * @param {( string | null) = } context an optional context
135+ * @param {( string | null) = } layer an optional layer in which the module is
136136 */
137137 constructor ( type , context = null , layer = null ) {
138138 super ( ) ;
@@ -151,7 +151,7 @@ class Module extends DependenciesBlock {
151151 this . debugId = debugId ++ ;
152152
153153 // Info from Factory
154- /** @type {ResolveOptions } */
154+ /** @type {ResolveOptions | undefined } */
155155 this . resolveOptions = EMPTY_RESOLVE_OPTIONS ;
156156 /** @type {object | undefined } */
157157 this . factoryMeta = undefined ;
@@ -167,9 +167,9 @@ class Module extends DependenciesBlock {
167167 this . _warnings = undefined ;
168168 /** @type {WebpackError[] | undefined } */
169169 this . _errors = undefined ;
170- /** @type {BuildMeta } */
170+ /** @type {BuildMeta | undefined } */
171171 this . buildMeta = undefined ;
172- /** @type {Record<string, any> } */
172+ /** @type {Record<string, any> | undefined } */
173173 this . buildInfo = undefined ;
174174 /** @type {Dependency[] | undefined } */
175175 this . presentationalDependencies = undefined ;
@@ -331,6 +331,10 @@ class Module extends DependenciesBlock {
331331 ) ;
332332 }
333333
334+ /**
335+ * @param {Chunk } chunk the chunk
336+ * @returns {boolean } true, when the module was added
337+ */
334338 addChunk ( chunk ) {
335339 const chunkGraph = ChunkGraph . getChunkGraphForModule (
336340 this ,
@@ -342,6 +346,10 @@ class Module extends DependenciesBlock {
342346 return true ;
343347 }
344348
349+ /**
350+ * @param {Chunk } chunk the chunk
351+ * @returns {void }
352+ */
345353 removeChunk ( chunk ) {
346354 return ChunkGraph . getChunkGraphForModule (
347355 this ,
@@ -350,6 +358,10 @@ class Module extends DependenciesBlock {
350358 ) . disconnectChunkAndModule ( chunk , this ) ;
351359 }
352360
361+ /**
362+ * @param {Chunk } chunk the chunk
363+ * @returns {boolean } true, when the module is in the chunk
364+ */
353365 isInChunk ( chunk ) {
354366 return ChunkGraph . getChunkGraphForModule (
355367 this ,
@@ -435,7 +447,7 @@ class Module extends DependenciesBlock {
435447 case "namespace" :
436448 return "namespace" ;
437449 case "default" :
438- switch ( this . buildMeta . defaultObject ) {
450+ switch ( /** @type { BuildMeta } */ ( this . buildMeta ) . defaultObject ) {
439451 case "redirect" :
440452 return "default-with-named" ;
441453 case "redirect-warn" :
@@ -447,7 +459,7 @@ class Module extends DependenciesBlock {
447459 if ( strict ) return "default-with-named" ;
448460 // Try to figure out value of __esModule by following reexports
449461 const handleDefault = ( ) => {
450- switch ( this . buildMeta . defaultObject ) {
462+ switch ( /** @type { BuildMeta } */ ( this . buildMeta ) . defaultObject ) {
451463 case "redirect" :
452464 case "redirect-warn" :
453465 return "default-with-named" ;
@@ -664,7 +676,7 @@ class Module extends DependenciesBlock {
664676 ] of moduleGraph . getIncomingConnectionsByOriginModule ( this ) ) {
665677 if ( ! connections . some ( c => c . isTargetActive ( chunk . runtime ) ) ) continue ;
666678 for ( const originChunk of chunkGraph . getModuleChunksIterable (
667- fromModule
679+ /** @type { Module } */ ( fromModule )
668680 ) ) {
669681 // return true if module this is not reachable from originChunk when ignoring chunk
670682 if ( ! this . isAccessibleInChunk ( chunkGraph , originChunk , chunk ) )
0 commit comments