Skip to content

typescript-rxjs: fix query parameters type#4160

Merged
macjohnny merged 3 commits intoOpenAPITools:masterfrom
macjohnny:bugfix/4159-typescript-rxjs-query-parameters-type
Oct 16, 2019
Merged

typescript-rxjs: fix query parameters type#4160
macjohnny merged 3 commits intoOpenAPITools:masterfrom
macjohnny:bugfix/4159-typescript-rxjs-query-parameters-type

Conversation

@macjohnny
Copy link
Copy Markdown
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
Copy Markdown
Contributor

denyo commented Oct 16, 2019

I would have preferred the as operator like as HttpQuery.

@denyo
Copy link
Copy Markdown
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
Copy Markdown
Member Author

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

@denyo
Copy link
Copy Markdown
Contributor

denyo commented Oct 16, 2019

I can't before next week.

@akehir
Copy link
Copy Markdown
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
Copy Markdown
Member

wing328 commented Oct 31, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in 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