Skip to content

Commit

Permalink
Fix custom resolver type
Browse files Browse the repository at this point in the history
The custom resolver is allowed to return undefined (really, any falsy value) if a module is not found, but this type definition requires it to return a string. This fixes the definition to allow undefined.
  • Loading branch information
bespokebob committed Feb 10, 2022
1 parent 532120d commit b7f794d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Expand Up @@ -20,7 +20,7 @@ export interface VMRequire {
/** Collection of mock modules (both external or builtin). */
mock?: any;
/* An additional lookup function in case a module wasn't found in one of the traditional node lookup paths. */
resolve?: (moduleName: string, parentDirname: string) => string;
resolve?: (moduleName: string, parentDirname: string) => string | undefined;
/** Custom require to require host and built-in modules. */
customRequire?: (id: string) => any;
}
Expand Down

0 comments on commit b7f794d

Please sign in to comment.