typescript-fetch: default to es6 support - #24226
Conversation
There was a problem hiding this comment.
2 issues found across 15 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java">
<violation number="1" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java:609">
P3: The updated comment has a grammar issue — it's missing punctuation or a conjunction between the two clauses. Consider: 'by default, ECMAScript 6 is supported; add another tsconfig for ESM (ECMAScript Module)' or 'ECMAScript 6 is supported by default; add another tsconfig for ESM (ECMAScript Module)' for clarity.</violation>
<violation number="2" location="modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java:609">
P2: The `supportsES6` CLI option is now dead for the typescript-fetch generator. All template conditionals referencing it have been removed, and the Java guard in `addNpmPackageGeneration()` is gone. However, the inherited `AbstractTypeScriptClientCodegen` still registers `--supportsES6` as a CLI option for this generator and processes it in `processOpts()`, so users can still pass it but it has no effect on the output. Consider removing or overriding the CLI option registration to avoid confusion — either by explicitly removing it in the `TypeScriptFetchClientCodegen` constructor or by keeping the option if it is still meaningful at the abstract level (in which case adding a usage comment or deprecation notice would help).</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); | ||
| } | ||
|
|
||
| // by default ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module) |
There was a problem hiding this comment.
P2: The supportsES6 CLI option is now dead for the typescript-fetch generator. All template conditionals referencing it have been removed, and the Java guard in addNpmPackageGeneration() is gone. However, the inherited AbstractTypeScriptClientCodegen still registers --supportsES6 as a CLI option for this generator and processes it in processOpts(), so users can still pass it but it has no effect on the output. Consider removing or overriding the CLI option registration to avoid confusion — either by explicitly removing it in the TypeScriptFetchClientCodegen constructor or by keeping the option if it is still meaningful at the abstract level (in which case adding a usage comment or deprecation notice would help).
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java, line 609:
<comment>The `supportsES6` CLI option is now dead for the typescript-fetch generator. All template conditionals referencing it have been removed, and the Java guard in `addNpmPackageGeneration()` is gone. However, the inherited `AbstractTypeScriptClientCodegen` still registers `--supportsES6` as a CLI option for this generator and processes it in `processOpts()`, so users can still pass it but it has no effect on the output. Consider removing or overriding the CLI option registration to avoid confusion — either by explicitly removing it in the `TypeScriptFetchClientCodegen` constructor or by keeping the option if it is still meaningful at the abstract level (in which case adding a usage comment or deprecation notice would help).</comment>
<file context>
@@ -605,10 +605,10 @@ private void addNpmPackageGeneration() {
- supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json"));
- }
+
+ // by default ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module)
+ supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json"));
+
</file context>
| supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json")); | ||
| } | ||
|
|
||
| // by default ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module) |
There was a problem hiding this comment.
P3: The updated comment has a grammar issue — it's missing punctuation or a conjunction between the two clauses. Consider: 'by default, ECMAScript 6 is supported; add another tsconfig for ESM (ECMAScript Module)' or 'ECMAScript 6 is supported by default; add another tsconfig for ESM (ECMAScript Module)' for clarity.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptFetchClientCodegen.java, line 609:
<comment>The updated comment has a grammar issue — it's missing punctuation or a conjunction between the two clauses. Consider: 'by default, ECMAScript 6 is supported; add another tsconfig for ESM (ECMAScript Module)' or 'ECMAScript 6 is supported by default; add another tsconfig for ESM (ECMAScript Module)' for clarity.</comment>
<file context>
@@ -605,10 +605,10 @@ private void addNpmPackageGeneration() {
- supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json"));
- }
+
+ // by default ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module)
+ supportingFiles.add(new SupportingFile("tsconfig.esm.mustache", "", "tsconfig.esm.json"));
+
</file context>
| // by default ECMAScript 6 is supported add another tsconfig for an ESM (ECMAScript Module) | |
| // by default, ECMAScript 6 is supported; add another tsconfig for ESM (ECMAScript Module) |
default to ES6 support as ES5 support has been deprecated in TypeScript
FYI @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) @davidgamero (2022/03) @mkusaka (2022/04) @joscha (2024/10) @dennisameling (2026/02)
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
Summary by cubic
Defaulted the
typescript-fetchgenerator to ES2015+ and now produce dual builds (CommonJS + ESM) by default. This adds ESM output and package fields, and removes ES5-specific config.New Features
tsconfig.esm.jsonand build ESM todist/esmviatsc && tsc -p tsconfig.esm.json.package.json: add"module": "./dist/esm/index.js"and"sideEffects": false.libsettings fromtsconfig.Migration
mainstays the same).supportsES6-conditional output.Written for commit 4496a07. Summary will update on new commits.