From 4be8bff84ef5ae16d31cca79ac9118be88e62b64 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Sat, 5 Oct 2024 11:48:50 +0200 Subject: [PATCH] fix(interopDefault): avoid `in` operator for primitive inputs (#321) --- src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils.ts b/src/utils.ts index 25087b2..2e794d5 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -103,7 +103,8 @@ export function jitiInteropDefault(ctx: Context, mod: any) { } function interopDefault(mod: any): any { - if (!mod || !("default" in mod)) { + const modType = typeof mod; + if (mod === null || (modType !== "object" && modType !== "function")) { return mod; }