Skip to content

fix(console): find nodejs.util.inspect.custom on Proxy objects via get trap#33265

Open
bartlomieju wants to merge 1 commit intomainfrom
fix/console-inspect-proxy-symbol
Open

fix(console): find nodejs.util.inspect.custom on Proxy objects via get trap#33265
bartlomieju wants to merge 1 commit intomainfrom
fix/console-inspect-proxy-symbol

Conversation

@bartlomieju
Copy link
Copy Markdown
Member

Summary

Deno's console.log/Deno.inspect used ReflectHas (the in operator) to check for Symbol.for('nodejs.util.inspect.custom'). For Proxy objects that override the has trap to hide symbols while still exposing them via get (e.g. nodejs-polars DataFrames), this caused the custom inspect to be skipped entirely.

Node.js accesses the symbol directly without going through has. This commit matches that behavior.

Before: console.log(df) outputs {} for a nodejs-polars DataFrame
After: console.log(df) outputs the formatted table (via the custom inspect method)

Test plan

  • Unit test inspectProxyWithNodeCustomInspect — Proxy that hides symbols from has/ownKeys but exposes via get
  • Existing inspectProxy tests pass (including the throwing-get-trap case)
  • tools/format.js, tools/lint.js --js clean

Closes #33236

🤖 Generated with Claude Code

…t trap

Deno's console.log/inspect used `ReflectHas` (the `in` operator) to
check for `Symbol.for('nodejs.util.inspect.custom')` on objects. For
Proxy objects that override the `has` trap to hide symbols (e.g.
nodejs-polars DataFrames which use Proxy for column access), this
returned false even though the symbol was accessible via the `get` trap.

Node.js accesses the symbol directly without checking `has` first. This
commit matches that behavior by accessing the property directly and
relying on the existing `typeof === "function"` check.

Closes #33236

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@eliottreich

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nodejs-polars give different output in Deno compared to Node

2 participants