Skip to content

[BUG] [typescript-fetch] Compile error when using "noImplicitOverride" in tsconfig and ES2022 #14515

Open

Description

@tomsontom

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

This is similar to issue #12948 but only happens when you use ES2022 as the target because there cause?: unknown has been added to Error in lib.es2022.error.d.ts

openapi-generator version

6.2.0

OpenAPI declaration file content or url

N/A

Generation Details

N/A

Steps to reproduce
diff --git a/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json b/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json
index 250280d9ab0..ec9f49f3844 100644
--- a/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json
+++ b/samples/client/petstore/typescript-fetch/builds/es6-target/tsconfig.json
@@ -5,6 +5,11 @@
     "module": "commonjs",
     "moduleResolution": "node",
     "outDir": "dist",
+    "noImplicitOverride": true,
+    "lib": [
+      "es2022",
+      "dom"
+    ],
     "typeRoots": [
       "node_modules/@types"
     ]
  • See the build fail with
src/runtime.ts:245:17 - error TS4115: This parameter property must have an 'override' modifier because it overrides a member in base class 'Error'.

245     constructor(public cause: Error, msg?: string) {
                    ~~~~~~~~~~~~~~~~~~~


Found 1 error in src/runtime.ts:245
Related issues/PRs
Suggest a fix

As this problem only occurs with ES2022 I guess one would have to introduce a special switch to know what ES-Version the generated code needs to compile with.

Activity

  1. jycr commented on Jan 7, 2025

    @jycr

    Any news about this issue?

  2. magulin commented on Apr 24, 2025

    @magulin

    Any update on this?

  3. mfarahat commented on Mar 25, 2026

    @mfarahat

    Any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions