Support TypeScript 7 applications with a package-owned compiler - #2867
Open
shreyam1008 wants to merge 3 commits into
Open
Support TypeScript 7 applications with a package-owned compiler#2867shreyam1008 wants to merge 3 commits into
shreyam1008 wants to merge 3 commits into
Conversation
👷 Deploy request for openapi-ts pending review.Visit the deploys page to approve it
|
🦋 Changeset detectedLatest commit: bc038f9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2 tasks
|
@shreyam1008 if we're aiming for bundle size reduction and already accepted we'll need a major release, I'd be looking to remove the entire TypeScript dependency and switch to raw string templates. Can you make that change? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
Fixes #2841. When an application installs TypeScript 7, the generator can resolve a compiler without the JavaScript
ts.factoryAPI and fail before generating anything. This PR givesopenapi-typescriptits own supported compiler dependency and exports it asts. The application's compiler andtscstay unchanged.ts, update the Node API examples, and include a major changeset..defaultfunction and named exports. The installed-consumer test exposed unbuild's incorrectexport = openapiTSrewrite.tsc.Major migration: callers creating, inspecting, or printing AST nodes should change:
This includes
transform,postTransform,transformProperty, and AST type annotations. Different compiler versions can assign different numericSyntaxKindvalues. CLI usage and generated output are unchanged. This supports TS7 applications through compiler isolation; it does not port generation to a native TS7 AST API.The proposed API/release scope was posted on the issue before implementation. #2862 is the separate documentation workaround for the published release.
Install-size tradeoff
TypeScript 5.9.3 is 23.6 MB unpacked. A compatible TS5 application can share that compiler; TS7 applications need both versions. The Node guide now states this explicitly.
Clean npm 11.11.1 installations on Windows/Node 24.19.0, comparing the exact PR base
0cc7ee77with the packed PR:These are logical file sizes in decimal MB, excluding external caches, not download sizes or browser bundles. The existing size-limit job measures
openapi-fetch; it does not verify this dependency cost.How to Review
Using pnpm 10.30.3:
Verified locally:
tscchecks pass. Fixtures compile with--strict --skipLibCheck falseand reject invalid generated-type data. Bun installations run under both Node and Bun.attwdeclaration/export checks pass; existing non-failing warnings remain.node_modulesretained, under both linkers.git diff --checkpass.The strict fixture supplies
@types/js-yamlandjson-schema-to-tsfor existing undeclared references in Redocly's public declarations. No declaration stubs,anycasts, orskipLibCheckworkaround are used.Checklist
update:examples— not run: no generation change; existing snapshots and example typechecks passImplementation and verification were performed with AI assistance. Maintainer agreement on compiler ownership, the size tradeoff, and the major release is still needed. The previous PR commit's upstream E2E job was cancelled during browser installation before tests ran; the results above are local verification, not a claim that the updated upstream CI has passed.