You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code produced by typescript-fetch does not compile (Typescript check fails) with the following errors:
"Property 'configuration' has no initializer and is not definitely assigned in the constructor."
"Property 'name' has no initializer and is not definitely assigned in the constructor."
"The operand of a 'delete' operator must be optional."
To make it compile, I had to change the following:
In class BaseAPI : protected configuration: Configuration; is replaced by protected configuration?: Configuration;
in class RequiredError: name: "RequiredError" is replaced by name= "RequiredError"
in classes *ApiFetchParamCreator : delete localVarUrlObj.search; is replaced by localVarUrlObj.search=null;
To reproduce...
Steps to reproduce the behavior:
open node_modules/swagger-editor-dist/index.html
load the open api definition provided here
press Generate-Client/typescript-fetch
add the generated code to a nodejs project
Expected behavior
The generated code does not exhibit errors (typescript check does not fail)
The text was updated successfully, but these errors were encountered:
chrisdrifte
added a commit
to chrisdrifte/swagger-codegen
that referenced
this issue
Mar 14, 2023
It looks like there's a couple typos that cause compilation to fail. I implemented the first two changes suggested in swagger-api#11870 as that is what allowed me to build in typescript 4.9.5.
Q&A (please complete the following information)
Content & configuration
Example Swagger/OpenAPI definition:
Describe the bug you're encountering
The code produced by typescript-fetch does not compile (Typescript check fails) with the following errors:
"Property 'configuration' has no initializer and is not definitely assigned in the constructor."
"Property 'name' has no initializer and is not definitely assigned in the constructor."
"The operand of a 'delete' operator must be optional."
To make it compile, I had to change the following:
In class
BaseAPI
:protected configuration: Configuration;
is replaced byprotected configuration?: Configuration;
in class
RequiredError
:name: "RequiredError"
is replaced byname= "RequiredError"
in classes
*ApiFetchParamCreator
:delete localVarUrlObj.search;
is replaced bylocalVarUrlObj.search=null;
To reproduce...
Steps to reproduce the behavior:
Expected behavior
The generated code does not exhibit errors (typescript check does not fail)
The text was updated successfully, but these errors were encountered: