@@ -45,7 +45,9 @@ type InternalModuleOptions = {
4545 isInternalModule : boolean ;
4646} ;
4747
48- type ModuleRegistry = { [ key : string ] : Module } ;
48+ type InitialModule = Partial < Module > &
49+ Pick < Module , 'children' | 'exports' | 'filename' | 'id' | 'loaded' > ;
50+ type ModuleRegistry = { [ key : string ] : InitialModule } ;
4951type ResolveOptions = Parameters < typeof require . resolve > [ 1 ] ;
5052
5153type BooleanObject = { [ key : string ] : boolean } ;
@@ -323,7 +325,7 @@ class Runtime {
323325 // We must register the pre-allocated module object first so that any
324326 // circular dependencies that may arise while evaluating the module can
325327 // be satisfied.
326- const localModule : Module = {
328+ const localModule : InitialModule = {
327329 children : [ ] ,
328330 exports : { } ,
329331 filename : modulePath ,
@@ -412,7 +414,7 @@ class Runtime {
412414 }
413415 }
414416 if ( isManualMock ) {
415- const localModule : Module = {
417+ const localModule : InitialModule = {
416418 children : [ ] ,
417419 exports : { } ,
418420 filename : modulePath ,
@@ -621,7 +623,7 @@ class Runtime {
621623 }
622624
623625 private _execModule (
624- localModule : Module ,
626+ localModule : InitialModule ,
625627 options : InternalModuleOptions | null | undefined ,
626628 moduleRegistry : ModuleRegistry ,
627629 from : Config . Path | null | undefined ,
@@ -828,7 +830,7 @@ class Runtime {
828830 }
829831
830832 private _createRequireImplementation (
831- from : Module ,
833+ from : InitialModule ,
832834 options : InternalModuleOptions | null | undefined ,
833835 ) : LocalModuleRequire {
834836 // TODO: somehow avoid having to type the arguments - they should come from `LocalModuleRequire`
0 commit comments