Support TypeScript5.9.x and hey-api/openapi-ts 0.92.x#192
Open
TakehiroTada wants to merge 8 commits into7nohe:mainfrom
Open
Support TypeScript5.9.x and hey-api/openapi-ts 0.92.x#192TakehiroTada wants to merge 8 commits into7nohe:mainfrom
TakehiroTada wants to merge 8 commits into7nohe:mainfrom
Conversation
- Use Identifier.text instead of getText() for robust HTTP method name extraction - Fix JSDoc extraction by searching from VariableStatement level instead of ArrowFunction - Update tests/utils.ts to use hey-api 0.90.1 plugins API - Update test snapshots to include correctly extracted JSDoc comments Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- service.mts: remove all `as` casts by using ts.isArrowFunction, ts.isReturnStatement, ts.isCallExpression type guards for proper narrowing - createExports.mts: use reduce generic, ts.isTypeLiteralNode, ts.isPropertySignature type guards, and type predicate filter - createUseQuery.mts: add comments explaining unavoidable assertions on factory-created nodes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Upgrade @hey-api/openapi-ts from 0.90.1 to 0.92.3 - Add vendor-typestubs.d.ts for framework-specific modules (Angular, Vue, Nuxt, ofetch) bundled in @hey-api/openapi-ts but not used in this project - Add @types/semver for @hey-api/shared's semver import - Patch @hey-api/openapi-ts to suppress TS2416 toAst() variance error caused by bundled declaration file incorrectly constraining base type - Remove skipLibCheck: true from tsconfig.json (now defaults to false) - Add biome override to allow any in type stubs file Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Generate backward-compatible services.gen.ts shim (re-exports from
client.gen and sdk.gen) so existing import paths continue to work
- Fix missing error type references: fall back to `unknown` when
${methodName}Error type does not exist in generated types
- Fix incorrect `= {}` default for required SDK parameters by checking
parameter optionality directly instead of extracting type properties
- Add @hey-api/client-fetch to nextjs-app and tanstack-router-app
- Add target: es2017 to nextjs-app tsconfig for iterator support
- Remove stale @hey-api/client-fetch import from react-app App.tsx
- Update test snapshots
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Map CLI options (--enums, --noOperationId, --noSchemas, --schemaType) to the new @hey-api/openapi-ts plugins API in generate.mts - Mark --useDateType and --debug as deprecated (no equivalent in new API) - Update introduction.mdx with new output directory structure (sdk.gen.ts, client.gen.ts, client/, core/) - Update cli-options.mdx with accurate option descriptions - Update usage.mdx to mention sdk.gen.ts and services.gen.ts shim Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@TakehiroTada is attempting to deploy a commit to the Daiki Urata's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Summary
This PR upgrades the core dependencies to support TypeScript 5.9.x and the latest
@hey-api/openapi-ts(0.92.3), which introduced a completely new plugins-based configuration system.Dependency Upgrades
typescriptts-morph@hey-api/openapi-tsKey Changes
1. Migration to
@hey-api/openapi-tsPlugins System@hey-api/openapi-ts0.92.3 replaced its flat configuration (client,schemas,services,types) with a plugins array. Thegenerate.mtshas been updated to build the plugins array from CLI options:@hey-api/client-fetch/@hey-api/client-axios— selected via--client@hey-api/typescript— acceptsenumsoption from--enums@hey-api/sdk— acceptsoperationIdoption from--noOperationId@hey-api/schemas— conditionally added (controlled by--noSchemas), acceptstypefrom--schemaType2. Backward-Compatible
services.gen.tsShimThe new
@hey-api/openapi-tsgeneratessdk.gen.ts(SDK functions) andclient.gen.ts(client instance) instead of the oldservices.gen.ts. To avoid breaking existing user code that imports fromservices.gen.ts, a shim file is auto-generated:3. TypeScript 5.9 Compatibility for
ts-morphIn TS 5.9, the
SyntaxKindenum values shifted (e.g.,ArrowFunctionchanged from 219 to 220). Sincets-morphbundles its own TypeScript internally, usingts.isArrowFunction()from a separately importedtypescriptpackage caused mismatches. The fix:service.mts: UpdatedgetMethodsFromService()to handle both old-style (block body) and new-style (expression body) arrow functions generated by@hey-api/sdkastype assertions with proper type guards usingts.isArrowFunction(),ts.isBlock(), etc.4. Codegen Bug Fixes
createUseQuery.mtsandcreateUseMutation.mtsto correctly extract error types from the new SDK function signatures (generics order changed:<ResponseType, ErrorType, ThrowOnError>)clientOptionsoptional when the SDK function has no required parameters (usingOptions<Data, true> = {}default)createImports.mtsto importOptionstype from the newclientmodule path instead of the oldcorepath5.
skipLibCheck: falseSupportsrc/vendor-typestubs.d.tswith type stubs for@hey-api/openapi-tsinternal modules that lack proper type exportspnpm patchfor@hey-api/openapi-ts@0.92.3to fix a missing type exportbiome.jsonto exclude vendor type stubs from linting6. Documentation Updates
introduction.mdxto reflect new file layout (sdk.gen.ts,client.gen.ts,client/,core/)--useDateTypeand--debugas deprecated incli-options.mdx(no equivalent in the new plugins API)--format/--lintonly affecting thequeries/directoryusage.mdxto mention theservices.gen.tsbackward-compatibility shimDeprecated CLI Options
The following options are accepted but have no effect:
--useDateType@hey-api/typescriptplugin--debug@hey-api/openapi-tsconfigFiles Changed (26 files)
Core codegen:
src/generate.mts— Plugins-based config, shim generation, CLI option mappingsrc/service.mts— TS 5.9 compatible AST traversal for new SDK output formatsrc/createUseQuery.mts— Error type extraction, optional paramssrc/createUseMutation.mts— Error type extraction, optional paramssrc/createExports.mts— Type guard refactoringsrc/createImports.mts— New import pathssrc/createSource.mts— Updated service file referencesrc/common.mts— Simplified type utilitiessrc/constants.mts— Updated service file name constantTests:
tests/__snapshots__/createSource.test.ts.snap— Updated snapshotstests/__snapshots__/generate.test.ts.snap— Updated snapshotstests/createImports.test.ts— Updated test expectationstests/service.test.ts— Updated test expectationsDocs:
docs/src/content/docs/guides/introduction.mdxdocs/src/content/docs/guides/cli-options.mdxdocs/src/content/docs/guides/usage.mdxConfig & types:
package.json,pnpm-lock.yamlbiome.json,src/vendor-typestubs.d.tspatches/@hey-api__openapi-ts@0.92.3.patchTest Plan
pnpm test)--enums javascript/--enums typescript--noOperationId(function names change from operationId-based to HTTP method + path)--noSchemas(schemas.gen.ts not generated)--schemaType form(schemas.gen.ts generated with form type)--useDateType/--debug(deprecated, no error)nextjs-app,tanstack-router-app)