From 5a80d653c1a91c15c755dd3596757fde819f67cc Mon Sep 17 00:00:00 2001 From: skycurtain Date: Wed, 4 Mar 2026 14:45:57 +0800 Subject: [PATCH] =?UTF-8?q?refactor(array-tracer):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=B3=9B=E5=9E=8B=E9=BB=98=E8=AE=A4=E5=80=BC=E5=B9=B6=E9=87=8D?= =?UTF-8?q?=E5=91=BD=E5=90=8D=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除 `T extends JsonValue = JsonValue` 中的默认类型参数 - 将接口中的 `item` 参数重命名为 `element` 以提高可读性 - 删除被注释掉的调试代码 `console.log` --- tracers.ts/src/tracers/array-tracer.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tracers.ts/src/tracers/array-tracer.ts b/tracers.ts/src/tracers/array-tracer.ts index fc348e0..8e34016 100644 --- a/tracers.ts/src/tracers/array-tracer.ts +++ b/tracers.ts/src/tracers/array-tracer.ts @@ -1,17 +1,17 @@ import { getTracerContext } from '../context'; import type { JsonValue } from '../types'; -interface ArrayTracerCreateOptions { +interface ArrayTracerCreateOptions { description?: string; initial?: T[]; - walker?: (builder: { add: (item: T) => void }) => void; + walker?: (builder: { add: (element: T) => void }) => void; } interface ArrayTracerMetadata { length: number; } -export const createArrayTracer = ( +export const createArrayTracer = ( options: ArrayTracerCreateOptions, ) => { const { description, initial, walker } = options; @@ -37,8 +37,6 @@ export const createArrayTracer = ( return []; }; - // console.log(_initial); - const { command } = getTracerContext(); const validateIndex = (index: number) => {