Repository navigation
fix(build): declare @types/react for the React libraries whose typings import it - #37066
Conversation
…s import Thirty-one packages in the lockfile ship .d.ts files that import 'react' without declaring @types/react, so from their pnpm store directories those types resolved only through pnpm's hidden hoist. Declare the peer through packageExtensions so the workspace's one @types/react is linked beside each. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAm71aMRY4WZ9sKzkAu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAm71aMRY4WZ9sKzkAu
…react peer Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01J8VVAm71aMRY4WZ9sKzkAu
|
这个补丁是不是有点夸张,没有什么官方的升级方案吗,比如升级某个库 |
|
repo:objectstack#2 · huangyiirene · session_01J8VVAjUnwjG1e7EW88ruEN L1 review · ACCEPTReviewed head: 席位核对
|
|
repo:objectstack#2 · huangyiirene · session_01J8VVAm71aMRY4WZ9sKzkAu @os-zhuang 回复 7142687548 「这个补丁是不是有点夸张,没有什么官方的升级方案吗」:查了上游:核对过的 4 个主要库里,只有 2 个有官方升级可用,所以单靠升级库补不全这一族。 npm 实测(2026-11-25T00:44Z)
其余 27 个库在本仓锁定的版本里同样是类型文件 import 了 为什么用
提议
这样可以接受吗?在您回复同意(或维护者指示合入)之前,这个 PR 不会挂自动合并。 Generated by Claude Code |
|
repo:objectstack#3 · os-support-ai · session_01WGufzi4PechTRCTBrfxV8W Maintainer ruling recorded · 2026-11-25T02:38Z @os-zhuang asked (7142687548) whether an official library upgrade could replace this patch. Seat 3 checked all 31 libraries on npm. Only 7 declare The maintainer then chose on a decision card: merge this PR as it is, and handle the upgrades on a separate card. That answers the question in 7148839083 ("这样可以接受吗?"). The owning seat (repo:objectstack#2) lands this PR on its usual path: a fresh L1 on the current head The follow-up upgrade card is #37186, blocked by this PR. Each upgraded library's Generated by Claude Code |
Requested by Irene · project thread
Fixes #37015
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
.d.tsfiles that importreactbut declare no@types/react(React 19 ships no types). From their pnpm store directories those imports resolved only through pnpm's hidden hoist (node_modules/.pnpm/node_modules). With the hoist off, TypeScript reports nothing for the library (skipLibCheck) and degrades every React type in it toany/{}:useContext(I18nContext)became{}(the maintainer's TS2339 atpackNamespace.ts),LucidePropslostclassName, theinput-otpcontext becameunknown,cmdkcallbacks became implicitany.pnpm-workspace.yamlgains apackageExtensionsblock declaring@types/react(plus@types/react-domforreact-routerandnext) as a peer of each of the 31 packages. pnpm then links the workspace's own@types/reactinto each package's store directory, so the types resolve the same way under any hoist setting.pnpm-lock.yamlis the regenerated consequence:packageExtensionsChecksumplus peer suffixes on snapshot keys; no version moves, still exactly one@types/react@19.3.0and one@types/react-dom@19.3.0.packNamespace.tsfixes one line out of a family of 31 packages. The console build would stop at the next one (@object-ui/components, measured below).public-hoist-patternfor@types/*is still hoisting. It works only while the package's real path sits under the project root, so it fails under a global virtual store. It also makes@types/reactvisible to every workspace package that does not declare it.@types/react, which would split React's types.ui/packages/i18n/src/__tests__/react-typings-own-resolution-37015.test.tsasks TypeScript's own module resolver wherereactresolves from the typings of each third-party dependency of@object-ui/i18n. It uses a host that cannot see above thenode_modulesdirectory holding that library, so it judges the no-hoist layout whatever the running install hoisted. A pin asserts thatreact-i18nextis among the packages checked.ui/scripts/__tests__/check-lockfile-integrity.test.ts: sample (b) pins the snapshot key'@ai-sdk/react@4.0.121(react@19.3.0)(zod@4.6.7)', which the peer moves to'@ai-sdk/react@4.0.121(@types/react@19.3.0)(react@19.3.0)(zod@4.6.7)'. One string is changed to the key now in the lockfile; nothing else in that file changes. The seat granted the surface for this edit (claim amendment 7140294701).Tests
Before / after on the hoist-disabled install (fail → pass)
Install:
pnpm install --config.hoist=false --ignore-scripts(nonode_modules/.pnpm/node_modules).pnpm turbo run build --filter=@object-ui/i18n→ exit 2,src/namespaces/packNamespace.ts(302,48): error TS2339: Property 'i18n' does not exist on type '{}'.--continue(turbo run build:dist --filter=@objectstack/console) → exit 2. 26 tasks failed. The root errors were i18n (above) and@object-ui/components: TS2339classNameonLucideProps, TS18046 on theinput-otpcontext, TS7006 on acmdkcallback. The rest cascaded from those two packages having no declarations.turbo run type-checkover the 25 ui packages that consume a family library → exit 2, 48 tasks failed.Tasks: 77 successful, 77 total. The type-check sweep → exit 0,Tasks: 100 successful, 100 total. No ui type-check task was replayed from cache.reacthad no@types/reactsibling. After, 0 of 88.Ablation: drop only react-i18next's packageExtensions line
Done with
scripts/ablation-replace.mjs: anchor 1 → 0, blob b5191a6c → 96febcb1. Restored to HEAD blob b5191a6c,git diff HEADempty, lockfile restored withgit checkout HEAD --.@object-ui/i18nbuild (forced) is back to exit 2 with the same TS2339.pnpm install --frozen-lockfile, hidden hoist present): the i18n build is GREEN (exit 0), and the guard test is RED (1 failed | 1 passed). A build or type check cannot see this regression on CI's hoisting install. The test can.Normal hoisting install, after the fix
pnpm install --frozen-lockfile→ exit 0, which also shows the lockfile matchespackageExtensions.@object-ui/i18nbuild--force: 5/5.turbo run build:dist --filter=@objectstack/console --force(whatpnpm console:buildruns) → exit 0,Tasks: 77 successful, 77 total,Cached: 0 cached, 77 total.pnpm --filter @object-ui/i18n type-checkpassed.tsc -p tsconfig.test.json --listFilesincludes the new test.pnpm --dir ui exec vitest run packages/i18n/→Test Files 111 passed (111),Tests 2028 passed | 13 skipped.Acceptance notes
ui/scripts/__tests__/check-lockfile-integrity.test.ts, sample (b): the peer moved the pinned snapshot key from'@ai-sdk/react@4.0.121(react@19.3.0)(zod@4.6.7)'to'@ai-sdk/react@4.0.121(@types/react@19.3.0)(react@19.3.0)(zod@4.6.7)'. The key is rebuilt to that spelling at e328e13, one string and nothing else in the file, under the seat's surface grant (claim amendment 7140294701 on console build on macOS: @object-ui/i18n fails TS2339 at packNamespace.ts:302 (I18nContext read as {}) #37015). That file plus the guard test:Test Files 2 passed (2),Tests 19 passed (19).check:dual-build-cjs-loadsprinted PREREQUISITE NOT MET locally because this worktree has no fullpnpm build. Not measured here; CI runs it.@types/reactof their own (layout,plugin-dashboard,plugin-form,plugin-grid,plugin-view). They find it by walking up toui/node_modules. Noted only; their builds pass both ways.useContext(acrossui/packagesfound two third-party contexts read directly:I18nContextinpackNamespace.ts, and theinput-otpcontext incomponents/src/ui/input-otp.tsx. Both are covered by this fix.useTranslationandI18nextProviderinprovider.tsxdegraded without any error before the fix: line 302 was the only i18n error. Inferred from that one error; not measured separately.reactwithout a declared or extended@types/react, or a CI leg that installs withhoist=false. It needsscripts/plus a governed workflow, so it is not added here. Carrier: CI: no guard catches a package whose types resolve only through pnpm's hidden hoist (the #37015 Mac build failure family) #37068 (p2, lands after this PR).Verification
First files to read, highest risk first:
pnpm-workspace.yaml: thepackageExtensionsblock and its comment.pnpm-lock.yaml: only peer suffixes andpackageExtensionsChecksumshould change.ui/packages/i18n/src/__tests__/react-typings-own-resolution-37015.test.ts: the confined resolver host.Also changed:
ui/scripts/__tests__/check-lockfile-integrity.test.ts, the one-string sample-key rebuild.Two-minute check: from a clean checkout,
pnpm install --frozen-lockfile --config.hoist=false --ignore-scripts && pnpm turbo run build --filter=@object-ui/i18n. ExpectTasks: 5 successful, 5 total. On origin/main the same command fails with the TS2339 above.Gates (local subset, head 86e2b45): 41 of the 42
dispatch-gates --commandsfamilies exited 0.check:dual-build-cjs-loadsprinted PREREQUISITE NOT MET (exit 3).pnpm --dir ui exec vitest run scripts/gave 171 files passed and 1 failed at 86e2b45: the lockfile-integrity sample, rebuilt at e328e13 and passing there.https://claude.ai/code/session_01J8VVAm71aMRY4WZ9sKzkAu
🤖 Generated with Claude Code