Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

util.format %o passes the wrong showHidden flag to custom inspectors

オープン
#2,571 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@MathurAditya724 がすでに取り組んでいます。

2026年10月29日 から。

  • #2572 @MathurAditya724 による — オープン

評価

難易度
4/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
typescript
領域
backend

調査の方向性

Start with packages/runtime/src/scr_inspect.c near the custom inspector options object, where the issue identifies showHidden as hardcoded. Trace how the active inspection walk sets that value, then review the regression coverage for nested inspectors, thrown nested calls, and mixed %o/%O substitutions. Done means %o callbacks receive true, %O and default inspection receive false, and nested calls restore the surrounding walk; linked PR #2572 is already open.

索引モデルが issue の本文から書いたものです。

説明

We are trying to compile a full TypeScript CLI and its logger dependencies with scriptc while preserving their behavior under Node. During that compatibility work, we found that a custom inspector receives the wrong showHidden flag when util.format uses %o. A logger that chooses its output from this flag can therefore print different diagnostics after native compilation.

Reproduction
const util = require('node:util');
const value = {
  [util.inspect.custom](depth, options) {
    return options.showHidden ? 'hidden=true' : 'hidden=false';
  }
};
console.log(util.format('%O', value));
console.log(util.format('%o', value));
console.log(util.format('%o', { nested: value }));
console.log(util.format('%O', value));

Node v24.22.0 prints:

hidden=false
hidden=true
{ nested: hidden=true }
hidden=false

A native binary built from current scriptc main prints:

hidden=false
hidden=false
{ nested: hidden=false }
hidden=false

Both programs exit successfully with empty stderr, so this is an output difference rather than a compilation refusal.

Cause and expected behavior

The %o runtime walk already enables hidden properties, but the options object passed to custom inspectors hardcodes showHidden: false. That value should describe the active walk. %O and default util.inspect should continue to pass false; %o should pass true, including for nested custom inspectors and class instances reached through unknown.

Nested inspect and format calls must still start with their own defaults and restore the surrounding walk when they finish or throw. Regression tests should check those transitions as well as mixed %o and %O substitutions in one call.

Related work and scope

The merged #1848 added hidden-property rendering over checked-dynamic values. The currently open #2562 addresses circular references and traversal limits in inspection; its current diff does not change the callback's showHidden value. Searches for showHidden and custom inspection found no separate issue or PR for this callback mismatch.

This report concerns the showHidden value in custom inspection callbacks. Support for explicitly requesting showHidden: true, the existing refusal for static typed %o calls over custom inspectors, other callback options such as showProxy, and numeric separators are separate compatibility work.

主要言語
TypeScript
スター
6.4k
フォーク
201
平均マージ
6時間 56分
マージ済み PR(30日)
916

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

vercel-labs/scriptc のほかの issue

vercel-labs/scriptc の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。