[BUG][typescript-fetch] Compile error when using "noImplicitOverride" in tsconfig
Created by: douniii
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
When compiling the generated code with a tsconfig where "noImplicitOverride": true
(see here) is set, the compiler complains about the not marked overrides:
This member must have an 'override' modifier because it overrides a member in the base class 'Error'.
openapi-generator version
6.0.1 (and master) by using "@openapitools/openapi-generator-cli": "2.5.1"
OpenAPI declaration file content or url
N/A
Generation Details
openapi-generator-cli generate -i ./openapi.json -g typescript-fetch -o src/generated-sources/openapi --additional-properties=supportsES6=true,npmVersion=8.6.0,typescriptThreePlus=true
Steps to reproduce
Checkout https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/typescript-fetch/builds/es6-target
and add to the tsconfig "noImplicitOverride": true,
.
{
"compilerOptions": {
"noImplicitOverride": true,
"declaration": true,
"target": "es6",
"module": "commonjs",
"moduleResolution": "node",
"outDir": "dist",
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"dist",
"node_modules"
]
}
and build it.
Related issues/PRs
Suggest a fix
Place "override" before overridding props/methods here https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L222 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L229 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L230 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L236