diff --git a/nix-js/runtime-ts/src/helpers.ts b/nix-js/runtime-ts/src/helpers.ts index c48e31e..3c5689c 100644 --- a/nix-js/runtime-ts/src/helpers.ts +++ b/nix-js/runtime-ts/src/helpers.ts @@ -265,10 +265,11 @@ function selectWithDefault_impl(obj: NixValue, attrpath: NixValue[], default_val } export const hasAttr = (obj: NixValue, attrpath: NixValue[]): NixBool => { - if (!isAttrs(obj)) { + const forced = force(obj); + if (!isAttrs(forced)) { return false; } - let attrs = obj; + let attrs = forced; for (const attr of attrpath.slice(0, -1)) { const cur = force(attrs[forceString(attr)]);