Skip to content

fix: pin typescript to 5.x so the SDK codegen runs again - #36

Merged
QuanticPotatoes merged 4 commits into
masterfrom
fix/openapi-ts-ts7
Sep 1, 2026
Merged

fix: pin typescript to 5.x so the SDK codegen runs again#36
QuanticPotatoes merged 4 commits into
masterfrom
fix/openapi-ts-ts7

Conversation

@QuanticPotatoes

@QuanticPotatoes QuanticPotatoes commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Problem

pnpm run generate has failed on every Generate SDK dispatch since 2026-08-29 — 10 consecutive runs. The published SDK is therefore frozen at API spec 1.109.0 while production is at 1.114.0 (missing: GET /v2/e-invoicing/platform-choice, the PlatformTransferStatus / ReadMePlatformTransferDto / RegistrationStatus schemas, and changes to ReadMeDto, ReadMeEInvoicingDto, PushNotificationPreferencesDto).

TypeError: Cannot read properties of undefined (reading 'LineFeed')
  at @hey-api/openapi-ts/dist/init-*.mjs:4156
      newLine: ts.NewLineKind.LineFeed,

Cause

openapi-ts is built on the legacy TypeScript compiler API. TypeScript 7 (tsgo) exports nothing of it from the main entry:

$ node -p "Object.keys(require('typescript'))"
[ 'version', 'versionMajorMinor' ]

Everything moved behind typescript/unstable/*, so every ts.* read is undefined. The breakage landed with 0443560 (chore: pnpm 11, TypeScript 7, oxlint, 2026-08-27 12:12) — 4 h after the last green generate.

Two dead ends, measured, so nobody repeats them:

Fix

Root typescript back to ^5.9.3. Nothing here needs TS 7: the bundle comes out of esbuild, and 5.9 covers tsc --noEmit and the declaration emit. tsgo can return once hey-api supports it.

Plus a codegen CI job. No job ran pnpm run generate, which is exactly why CI stayed green through ten failed dispatches — the repo's core function was broken and nothing said so. It now regenerates from the committed spec and fails on drift.

Two smaller items ride along:

  • README — the Validation section claimed responses are validated by Zod. They are not: openapi-ts.config.ts sets responses: false deliberately, and the generated client holds 142 requestValidator calls and 0 responseValidator. Also adds abby.customerPortal, which was missing from the service list (9 documented for 10 exposed).
  • .worktrees/ ignored by git and prettier — a local worktree put 15 untracked files into pnpm run format:check.

Verification

Gate Result
generate from the committed 1.109.0 spec src/client byte-identical — same output as the last green run
lint / format:check / typecheck pass
build:only pass (cjs + esm + types)
test 44/44
generate from the live 1.114.0 spec, then build + test pass, 44/44

After merge

Publication will not restart on its own: the monorepo only dispatches on promote-to-prod when the spec hashes differ. Trigger Generate SDK manually (workflow_dispatch, bump minor) to get the 1.114.0 update PR and the release.


Note

Medium Risk
Pins the build/codegen toolchain and adds a gate on generated client output; no runtime SDK logic changes in the diff, but incorrect drift checks could block merges until src/client is regenerated.

Overview
Restores pnpm run generate by pinning TypeScript to ^5.9.3 (from 7.x), because @hey-api/openapi-ts still depends on the legacy compiler API that TS 7 no longer exposes from the main package.

Adds a codegen CI job that runs pnpm run generate against the committed OpenAPI spec and fails if src/client drifts, and wires that job into ci-success so broken codegen can’t stay green while release workflows fail.

README now documents request-only Zod validation (responses are typed but not runtime-validated) and lists abby.customerPortal. .worktrees/ is ignored for git and Prettier.

Reviewed by Cursor Bugbot for commit c93ca89. Bugbot is set up for automated code reviews on this repo. Configure here.

`pnpm run generate` has failed on every Generate SDK dispatch since
2026-08-29 (10 consecutive runs), freezing the published SDK at API
spec 1.109.0 while production reached 1.114.0:

    TypeError: Cannot read properties of undefined (reading 'LineFeed')
      at @hey-api/openapi-ts/dist/init-*.mjs
        newLine: ts.NewLineKind.LineFeed

openapi-ts is built on the legacy TypeScript compiler API. TypeScript 7
(tsgo) exports only { version, versionMajorMinor } from its main entry
and moved that API behind `typescript/unstable/*`, so every `ts.*` read
is undefined. Measured: 0.99.0 fails identically on `ts.SyntaxKind`, so
upgrading the generator is not a fix. openapi-ts declares typescript as
a peer (">=5.5.3 || >=6.0.0"), which TS 7 satisfies numerically — pnpm
`overrides` and `packageExtensions` both lose to the peer, so scoping
the pin to the generator alone does not work either.

Revert the root devDependency to ^5.9.3. Nothing else in the repo needs
TS 7: the bundle is built by esbuild, and 5.9 covers `tsc --noEmit` and
the declaration emit. tsgo can come back once hey-api supports it.

Also add a `codegen` CI job. No job ran `pnpm run generate`, which is
why CI stayed green through ten failed dispatches; it now regenerates
from the committed spec and fails on drift.

Verified locally: generate reproduces src/client byte-identical from
the committed spec, and regenerating from the live 1.114.0 spec builds
and passes 44/44 tests.
Two factual errors on the npm landing page:

- The Validation section promised that responses are validated by Zod.
  They are not: openapi-ts.config.ts sets responses: false (deliberately,
  for API/spec mismatches), and the generated sdk.gen.ts holds 142
  requestValidator calls and 0 responseValidator calls.
- abby.customerPortal was missing from the service list — 9 listed for 10
  exposed by src/index.ts. It covers /v2/customer-portal/payments and the
  billing themes under /v2/billing/theme.
A local git worktree under .worktrees/ shows up as 15 untracked files in
'pnpm run format:check' (the .prettierignore 'src/client/' pattern does not
match .worktrees/<name>/src/client/), turning the local format gate red for
anyone who uses one.
@codecov

codecov Bot commented Sep 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #36   +/-   ##
=======================================
  Coverage   90.75%   90.75%           
=======================================
  Files           1        1           
  Lines         119      119           
  Branches       30       30           
=======================================
  Hits          108      108           
  Misses         11       11           
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 44b4d6b. Configure here.

Comment thread .github/workflows/ci.yml
The codegen job was declared but absent from ci-success's needs: and from
the results check it walks. ci-success runs under if: always() and inspects
only that list, so codegen could fail while the aggregate printed 'All jobs
passed' — the exact silent-pass the job exists to prevent.

Verified: needs, the results[] list and the set of defined jobs now all
coincide (7 each, no gap either way).
@QuanticPotatoes

Copy link
Copy Markdown
Contributor Author

ask-approval

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: medium. Approved after Cursor Bugbot and Cursor Security Agent completed successfully; the prior Bugbot finding is resolved. No reviewers assigned.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@QuanticPotatoes
QuanticPotatoes merged commit 81b288e into master Sep 1, 2026
17 checks passed
@QuanticPotatoes
QuanticPotatoes deleted the fix/openapi-ts-ts7 branch September 1, 2026 08:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant