Repository navigation
fix: unblock the admin build on TypeScript 7 - #8143
Conversation
develop has been red since #8132 bumped typescript to ^7.0.2: every PR fails at "Build admin ui" with TypeError: Cannot read properties of undefined (reading 'createKeywordTypeNode') openapi-typescript builds its output with the TypeScript *compiler API* (ts.factory, ts.SyntaxKind, the printer). TypeScript 7 is the native port and its main export is only ./lib/version.cjs -- that API is not there at all. Its declared peer range is `typescript: ^5.x` and 7.13.0 is the newest release, so there is nothing to upgrade to yet. Rather than hold the whole workspace back on TypeScript 6, isolate the one tool that can't move. openapi-typescript takes `typescript` as a PEER dependency, so pnpm satisfies it from whichever package depends on it -- while admin both depended on openapi-typescript and declared typescript ^7.0.2, the peer always resolved to 7. Neither `overrides` (openapi-typescript>typescript) nor `packageExtensions` changes that; both were tried and pnpm still linked the _typescript@7.0.2 variant. So move openapi-typescript into a private build-time workspace package, admin/tools/openapi-codegen, whose only TypeScript is 6.x. The peer then resolves to a version with a working compiler API, and admin keeps typescript ^7.0.2 like every other workspace. gen-api.mjs invokes the tool through that package. The codegen only runs at build time to emit admin/src/api/schema.d.ts, and that output is plain text which tsc 7 consumes normally -- the regenerated file is byte-identical to the committed one. Verified: all four workspaces report tsc 7.0.2 and typecheck clean, admin gen:api + full build pass, `pnpm install --frozen-lockfile` is consistent, backend suite 1621 passing / 0 failing. The package README records how to delete it once openapi-typescript supports the native compiler. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing |
PR Summary by QodoUnblock admin OpenAPI codegen on TypeScript 7 by isolating TS6 toolchain
AI Description
Diagram
High-Level Assessment
Files changed (6)
|
Code Review by Qodo🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)
Great, no issues found!Qodo reviewed your code and found no material issues that require reviewTip of the day💡 Did you know, you can turn on the rule miner and Qodo learns your standards from review history |
Supersedes #8142, which rolled TypeScript back to 6. This keeps us on 7 and fixes the actual incompatibility instead.
Problem
develophas been red since #8132 bumpedtypescriptto^7.0.2— every PR fails at "Build admin ui":openapi-typescriptbuilds its output with the TypeScript compiler API (ts.factory,ts.SyntaxKind, the printer). TypeScript 7 is the native port, and its main export is only./lib/version.cjs:The compiler API isn't there at all.
openapi-typescript's declared peer range istypescript: ^5.xand 7.13.0 is the newest published release, so there is nothing to upgrade to yet.Why the obvious fixes don't work
openapi-typescripttakestypescriptas a peer dependency, so pnpm satisfies it from whichever package depends on it. Whileadminboth depended onopenapi-typescriptand declaredtypescript: ^7.0.2, the peer always resolved to 7.I tried both root-level mechanisms and verified neither works — pnpm still linked the
_typescript@7.0.2variant intoadmin:Fix
Isolate the one tool that can't move.
openapi-typescriptgoes into a private, build-time-only workspace package —admin/tools/openapi-codegen— whose only TypeScript is 6.x. The peer then resolves to a version with a working compiler API, andadminkeepstypescript: ^7.0.2like every other workspace.gen-api.mjsinvokes the tool through that package.The codegen only runs at build time to emit
admin/src/api/schema.d.ts, and that output is plain text whichtsc7 consumes normally. The regenerated file is byte-identical to the committed one, so there's no downstream churn.The package's README records the reasoning and says to delete it once
openapi-typescriptsupports the native compiler.Verified locally
tsc7.0.2 and typecheck clean (src,ui,bin,admin)admingen:apisucceeds; fullpnpm buildsucceedspnpm install --frozen-lockfileconsistent (CI uses this)schema.d.tsbyte-identical to the committed fileFollow-up
Worth making the admin build a required check, so a dependency bump that breaks it can't land red again.
🤖 Generated with Claude Code