Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

typescript-rxjs: fix query parameters type #4160

Merged
merged 3 commits into from
Oct 16, 2019
Merged

typescript-rxjs: fix query parameters type #4160

merged 3 commits into from
Oct 16, 2019

Conversation

macjohnny
Copy link
Member

fixes #4159

cc @akehir @denyo

@macjohnny macjohnny changed the title Bugfix/4159 typescript rxjs query parameters type typescript-rxjs: fix query parameters type Oct 15, 2019
@macjohnny macjohnny added this to the 4.2.0 milestone Oct 15, 2019
@macjohnny macjohnny merged commit f195f8f into OpenAPITools:master Oct 16, 2019
@denyo
Copy link
Contributor

denyo commented Oct 16, 2019

I would have preferred the as operator like as HttpQuery.

@denyo
Copy link
Contributor

denyo commented Oct 16, 2019

Or even cleaner would be extending the definition of HttpQuery:

type HttpQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> } | {};

Then the generated controllers would not be affected at all.

@macjohnny
Copy link
Member Author

@denyo will you file a PR to make the changeS?

@denyo
Copy link
Contributor

denyo commented Oct 16, 2019

I can't before next week.

@akehir
Copy link
Contributor

akehir commented Oct 16, 2019

The problem is this:

type HttpQuery = ... | {};

If HttpQuery is defined as such, it should work:

type HttpQuery = Partial<{ [key: string]: string | number | null | boolean | Array<string | number | null | boolean> }>;

See a working example: TS Playground

@wing328
Copy link
Member

wing328 commented Oct 31, 2019

@macjohnny thanks for the PR, which has been included in v4.2.0 release: https://twitter.com/oas_generator/status/1189824932345069569

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] [typescript-rxjs] Typescript error in generated files for query parameters
4 participants