Skip to content

gen:docs 联合类型的每个对象变体都印一遍完整摘要,一个单元格里出现近乎相同的形状 N 次(PageSlots.slots 1538 字符,枚举已省略后仍如此) #6226

Description

@os-zhuang

实现 #5340(PR #6211)时量语料量出来的观察类发现,未认领,按 PD#10 立案。与 #6225 同批量出但机制不同,故分开立案。

现象

#5340 落地后仍有 27 个超过 400 字符的类型单元格。上一条(#6225)解释了其中 9 个「顶层长枚举」。剩下 18 个的宽度与枚举无关 —— 是联合类型把每个对象变体的完整摘要各印了一遍。

最清楚的实例是 content/docs/references/ui/page.mdxslots,枚举省略已经生效了 8 次(该行带 8 个 ... +N more 标记),单元格仍有 1538 字符:

{ header?: { type: Enum< 'page:header' | ... | … +29 more > | string; id?: string;
label?: string; properties?: Record< string, any >; … } | { type: Enum< 'page:header'
| ... | … +29 more > | string; ... } | ... }

同一个 { type; id?; label?; properties?; … } 形状被重复了 8 次,彼此只差极少。其余 17 个在 400–656 字符之间(kernel/manifest.mdxnavigationContributions / capabilitiesautomation/state-machine.mdxstatesui/app.mdxnavigationapi/protocol.mdxtranslations 等)。

定性(为什么这是独立的一条,也不是 #5340 的返工项)

可能的修法(未验证,留给分诊)

三种都涉及公开可读契约的取舍(读者看到的是变体的完整枚举还是数量),⛔ 不建议随手拍板;需要分诊给出方向。逐页确认重生成 diff,不得手改生成的 .mdx

相关 / 串行

同文件面:packages/spec/scripts/lib/format-type.ts。与 #5340(PR #6211)、#6225#5729#5606#5338 同源。须与该文件面的其他在飞单串行,不得同批并行。

Activity

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

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationfinding

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions