Skip to content

Commit 56b7aa3

Browse files
committed
simplify types a bit
1 parent 64bda74 commit 56b7aa3

File tree

1 file changed

+5
-21
lines changed

1 file changed

+5
-21
lines changed

packages/jest-resolve/src/defaultResolver.ts

Lines changed: 5 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,18 @@
77

88
import * as fs from 'graceful-fs';
99
import pnpResolver from 'jest-pnp-resolver';
10-
import {sync as resolveSync} from 'resolve';
10+
import {Opts as ResolveOpts, sync as resolveSync} from 'resolve';
1111
import type {Config} from '@jest/types';
1212
import {tryRealpath} from 'jest-util';
1313

14-
type ResolverOptions = {
14+
interface ResolverOptions extends ResolveOpts {
1515
basedir: Config.Path;
1616
browser?: boolean;
17+
conditions?: Array<string>;
1718
defaultResolver: typeof defaultResolver;
1819
extensions?: Array<string>;
19-
moduleDirectory?: Array<string>;
20-
paths?: Array<Config.Path>;
2120
rootDir?: Config.Path;
22-
packageFilter?: (
23-
pkg: Record<string, unknown>,
24-
pkgfile: string,
25-
) => Record<string, unknown>;
26-
pathFilter?: (
27-
pkg: Record<string, unknown>,
28-
path: string,
29-
relativePath: string,
30-
) => string;
31-
conditions?: Array<string>;
32-
};
21+
}
3322

3423
// https://github.com/facebook/jest/pull/10617
3524
declare global {
@@ -51,14 +40,9 @@ export default function defaultResolver(
5140
}
5241

5342
const result = resolveSync(path, {
54-
basedir: options.basedir,
55-
extensions: options.extensions,
43+
...options,
5644
isDirectory,
5745
isFile,
58-
moduleDirectory: options.moduleDirectory,
59-
packageFilter: options.packageFilter,
60-
pathFilter: options.pathFilter,
61-
paths: options.paths,
6246
preserveSymlinks: false,
6347
readPackageSync,
6448
realpathSync,

0 commit comments

Comments
 (0)