Skip to content

typeof process returns "number" instead of "object" (default-import + global) #623

@proggeramlug

Description

@proggeramlug

Repro

import process from "node:process";
console.log("default-import typeof:", typeof process);
console.log("default-import argv:", process.argv.length > 0 ? "have argv" : "no argv");

console.log("global typeof:", typeof (globalThis as any).process);

Actual

default-import typeof: number
default-import argv: have argv
global typeof: number

Expected (Node)

default-import typeof: object
default-import argv: have argv
global typeof: object

Notes

Surfaced during the #360 ink Phase B investigation (logged in v0.5.716's CLAUDE.md entry alongside a separate but related CJS-link bug filed separately).

Both shapes (default import + global access) report typeof === "number", but property access (process.argv.length) still works correctly — the property path goes through a separate getter that finds the real process binding while the bare-Ident lookup produces what looks like an uninitialized 0.0 read (NaN-box tag → number).

Same root-cause family as the createContext typeof bug from the original #360 sub-item 1 (cross-module call return-value typeof reads wrong tag): something in the binding pipeline is producing an f64 value with the wrong NaN-box tag, so typeof reads it as a number while accessing properties on it goes through machinery that finds the real object.

Acceptance

The 4-line repro above prints typeof === "object" for both surfaces matching Node, while keeping process.argv working.

Tracked-by

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions