Browse Source

fix(tools): restore the v8 ignore adjacency broken by an inserted comment

The directive must sit on the line before its target; the nesting-cap comment
displaced it onto a comment line, leaving the `?? ''` arm uncovered.
Chinesezjc 2 tháng trước cách đây
mục cha
commit
0d17baae01
1 tập tin đã thay đổi với 3 bổ sung và 3 xóa
  1. 3 3
      packages/core/tools/src/py-types.ts

+ 3 - 3
packages/core/tools/src/py-types.ts

@@ -433,11 +433,11 @@ function renderType(schema: unknown, className: string, state: RenderState): str
           frame.allocated = allocateClassName(frame.className, state)
           state.typing.add('TypedDict')
           frame.entries = entries
-          // frame.allocated was assigned two statements up; the ?? arm is for the type system only.
-          /* v8 ignore next -- allocated is always set before children are built. */
           // A field annotation is its own logical line, so nesting restarts —
           // at 1, reserving the bracket an optional field's `NotRequired[…]`
-          // wraps around it.
+          // wraps around it. frame.allocated was assigned three statements up;
+          // the ?? arm is for the type system only.
+          /* v8 ignore next -- allocated is always set before children are built. */
           frame.children = entries.map(([field, child]) => ({ schema: child, className: childClassName(frame.allocated ?? '', camelCase(field)), listDepth: 1 }))
           break
         }