Skip to content

typescript-fetch: default to es6 support - #24226

Merged
wing328 merged 2 commits into
masterfrom
remove-es5-support
Jul 7, 2026
Merged

wing328 merged 2 commits into
masterfrom
remove-es5-support

Conversation

@wing328

@wing328 wing328 commented Jul 7, 2026 •

Copy link
Copy Markdown
Member

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

  • Read the contribution guidelines.
  • Run the following to build the project and update samples:
    ./mvnw clean package || exit
    ./bin/generate-samples.sh ./bin/configs/*.yaml || exit
    ./bin/utils/export_docs_generators.sh || exit
    
    (For Windows users, please run the script in WSL)
    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.
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Summary by cubic

Defaulted the typescript-fetch generator 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

    • Always generate tsconfig.esm.json and build ESM to dist/esm via tsc && tsc -p tsconfig.esm.json.
    • package.json: add "module": "./dist/esm/index.js" and "sideEffects": false.
    • Remove legacy ES5 lib settings from tsconfig.
    • Update samples to reflect the new defaults.
    • Update tests to drop the ES5 path and expect ESM config by default.
  • Migration

    • No changes needed for CommonJS consumers (main stays the same).
    • If you relied on ES5 targets, move to ES2015+ or add polyfills.
    • Remove any tooling that assumes a supportsES6-conditional output.

Written for commit 4496a07. Summary will update on new commits.

Review in cubic

@wing328
wing328 marked this pull request as ready for review July 7, 2026 10:18

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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>
Suggested change
// 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)

@wing328 wing328 added this to the 7.24.0 milestone Jul 7, 2026
@wing328
wing328 merged commit de5cece into master Jul 7, 2026
20 checks passed
@wing328
wing328 deleted the remove-es5-support branch July 7, 2026 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant