From df4222e43f4c22df11cf5196b6cb795e4222f72a Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 7 Aug 2026 01:29:01 +0000 Subject: [PATCH] =?UTF-8?q?fix(scripts):=20=E5=88=A0=E9=99=A4=20check-doc-?= =?UTF-8?q?links=20=E6=B5=8B=E8=AF=95=E4=B8=AD=E5=B7=B2=E5=A4=B1=E6=95=88?= =?UTF-8?q?=E7=9A=84=20@ts-expect-error=20(#3504)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 净 main 上 `pnpm type-check:scripts` 红: scripts/__tests__/check-doc-links.test.ts(7,1): error TS2578: Unused '@ts-expect-error' directive. 这是两个各自绿的 PR 合并后产生的语义冲突: - #3489(449227d71)新增该测试时带 `@ts-expect-error`,当时正确 —— 彼时没有任何 tsc 程序 include `scripts/`,该导入确实无类型。 - #3498(f995a452d)引入 `tsconfig.scripts.json`(`allowJs: true`), 首次把 `scripts/**/*.ts` 纳入类型检查。`allowJs` 让 `.mjs` 助手的 类型可被推断,于是所有这类压制注释同时变成 Unused。#3498 修掉了它 base 上的 5 处同类,而 #3489 的第 6 处恰好落在其窗口之间。 两 PR 的 CI 各自为绿,合并结果为红 —— 当前所有 PR 的 Type Check 全部误红。 仅删除该行。运行期行为从不依赖该指令(它只影响 tsc,不影响 vitest), `check-doc-links.test.ts` 22 个用例保持全绿。 Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_01GTRjn8xBqp75dk7kFupVRt --- scripts/__tests__/check-doc-links.test.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/__tests__/check-doc-links.test.ts b/scripts/__tests__/check-doc-links.test.ts index e3abf074e..4f77ade29 100644 --- a/scripts/__tests__/check-doc-links.test.ts +++ b/scripts/__tests__/check-doc-links.test.ts @@ -4,7 +4,6 @@ import os from 'node:os'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; -// @ts-expect-error — plain-JS CI helper, intentionally untyped import { collectBrokenLinks, routeExists, stripCode } from '../check-doc-links.mjs'; /**