From b7f794dfb3034d2173b9da957f48425adc4081c3 Mon Sep 17 00:00:00 2001 From: Bob Thomas Date: Thu, 10 Feb 2022 10:03:33 -0500 Subject: [PATCH] Fix custom resolver type 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. --- index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index be5983f..9284e7f 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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; }