[BUG] [typescript-rxjs] Typescript error in generated files for query parameters
Created by: balazs-zsoldos
Description
In case Typescript strict mode is on, there is typescript error in the generated code if a function has one or more query parameters.
openapi-generator version
4.0.3 - 4.1.3
OpenAPI declaration file content or url
The standard petstore yaml file that is used to generate the samples.
Command line used for generation
See the samples directory for the generated files.
Steps to reproduce
- Download the typescript-rxjs/default (or any other) sample from the github master branch
- Copy it into a project where typescript strict mode is on, or
- Just open it in Visual Code to see the error in UserApi.ts loginUser function.
Generated code:
const query: HttpQuery = { ...(requestParameters.username && { 'username': requestParameters.username }), ...(requestParameters.password && { 'password': requestParameters.password }), };
Error message:
Type '{} | { 'username': string; } | { 'password': string; } | { 'password': string; 'username': string; }' is not assignable to type 'HttpQuery'. Type '{}' is not assignable to type 'HttpQuery'. Index signature is missing in type '{}'.
Related issues/PRs
none
Suggest a fix
The generated code was ok until 4.0.2. It would be good to check why the mustache files were changed to the new code.