openapi-generator
openapi-generator copied to clipboard
[BUG] [typescript-fetch] Compile error when using "noImplicitOverride" in tsconfig and ES2022
Bug Report Checklist
- [x] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [x] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] 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
- clone https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/typescript-fetch/builds/es6-target
- Modify tsconfig.json
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.
Any news about this issue?
Any update on this?
Any update on this?