Skip to content

Commit

Permalink
fix partial Module type errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jeysal committed Feb 23, 2019
1 parent 455d724 commit c7a7d0b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/jest-runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ type InternalModuleOptions = {
isInternalModule: boolean;
};

type ModuleRegistry = {[key: string]: Module};
type InitialModule = Partial<Module> &
Pick<Module, 'children' | 'exports' | 'filename' | 'id' | 'loaded'>;
type ModuleRegistry = {[key: string]: InitialModule};
type ResolveOptions = Parameters<typeof require.resolve>[1];

type BooleanObject = {[key: string]: boolean};
Expand Down Expand Up @@ -323,7 +325,7 @@ class Runtime {
// We must register the pre-allocated module object first so that any
// circular dependencies that may arise while evaluating the module can
// be satisfied.
const localModule: Module = {
const localModule: InitialModule = {
children: [],
exports: {},
filename: modulePath,
Expand Down Expand Up @@ -412,7 +414,7 @@ class Runtime {
}
}
if (isManualMock) {
const localModule: Module = {
const localModule: InitialModule = {
children: [],
exports: {},
filename: modulePath,
Expand Down Expand Up @@ -621,7 +623,7 @@ class Runtime {
}

private _execModule(
localModule: Module,
localModule: InitialModule,
options: InternalModuleOptions | null | undefined,
moduleRegistry: ModuleRegistry,
from: Config.Path | null | undefined,
Expand Down Expand Up @@ -828,7 +830,7 @@ class Runtime {
}

private _createRequireImplementation(
from: Module,
from: InitialModule,
options: InternalModuleOptions | null | undefined,
): LocalModuleRequire {
// TODO: somehow avoid having to type the arguments - they should come from `LocalModuleRequire`
Expand Down

0 comments on commit c7a7d0b

Please sign in to comment.