[TypeScript] Add Angular v7 support#1297
[TypeScript] Add Angular v7 support#1297wing328 merged 10 commits intoOpenAPITools:masterfrom topce:fix-ng7-compile
Conversation
|
Had the same idea. You were faster! 👍
|
|
@JohannesHoppe union type I put because formParams As in template they use that why I put union type main problem still is in generated code so if TS conclude that formParams is type of URLSearchParams or FormData on contrary if TS conclude that formParams is of type HttpParams you can see example in TS playground Maybe to see with @macjohnny to refactor code to be more typesafe @JohannesHoppe |
|
Regarding point 1: I see. Thanks for the detailed explanation! 😄 I appreciate your effort! 👍 Regarding point 2 + 3: |
JohannesHoppe
left a comment
There was a problem hiding this comment.
This will fix my build. Highly appreciated!
|
Hi @JohannesHoppe I noticed also that append in FormData has this signature I was playing in playground ;-) if ( formParams instanceof FormData ) { Thank you for your comments! |
|
Hi @JohannesHoppe Hi @macjohnny |
|
@topce thanks for the improvement. I am currently on holiday so I cant check it, but maybe @JohannesHoppe can review the changes? |
|
@macjohnny no problem enjoy holiday ;-) |
| } | ||
| {{/useHttpClient}} | ||
| {{^useHttpClient}} | ||
| formParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}'])); |
There was a problem hiding this comment.
What about removing 4-space to have the code better align?
{{^useHttpClient}}
formParams.append('{{baseName}}', {{paramName}}.join(COLLECTION_FORMATS['{{collectionFormat}}']));
{{/useHttpClient}}
| } | ||
| {{/useHttpClient}} | ||
| {{^useHttpClient}} | ||
| formParams.append('{{baseName}}', <any>{{paramName}}); |
There was a problem hiding this comment.
|
thanks @wing328 |
|
@JohannesHoppe @wing328 |
|
@topce the Travis CI tests failed with the following error messages: Please have a look and let us know if you can't reproduce it locally. |
|
@wing328 |
|
try @JohannesHoppe idea |
|
|
|
@wing328 on end of day I took @JohannesHoppe solution generated code is little bit strange |
|
@topce thanks for the enhancemet, which has been merged into master. Tweet to promote Angular v7 support: https://twitter.com/oas_generator/status/1056132688749355014 Hacker News: https://news.ycombinator.com/item?id=18315211 |
|
@topce thanks again for the PR, which is included in the v3.3.2 release: https://twitter.com/oas_generator/status/1057649626101112832 |
|
You are welcome!
Thank you for great code generator!!
…On Wed, 31 Oct 2018 at 17:04, William Cheng ***@***.***> wrote:
@topce <https://github.com/topce> thanks again for the PR, which is
included in the v3.3.2 release:
https://twitter.com/oas_generator/status/1057649626101112832
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1297 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AABRtsvCGq5l1SzulF0ZEPW9c1v9lgAuks5uqcn8gaJpZM4X1Fwb>
.
|
* fix wrong formParams type * run typescript-angular-petstore-all.bat * more typesafe fix * fix formatting * run typescript-angular-petstore-all.bat * fix compile problem with previous versions of angular * generate code * fix compile problem add <any> * try Johannes Hoppe solution * generate files
PR checklist
./bin/to update Petstore sample so that CIs can verify the change. (For instance, only need to run./bin/{LANG}-petstore.shand./bin/security/{LANG}-petstore.shif updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates). Windows batch files can be found in.\bin\windows\.master,3.4.x,4.0.x. Default:master.Description of the PR
There is problem when compile in strict mode typescript-angular generator
because type of formParams was not good
let formParams: { append(param: string, value: any): void; }it should be
let formParams: { append(param: string, value: any): void; } | { append(param: string, value: any): HttpParams; };@wing328
@TiFu @taxpon @sebastianhaas @kenisteward @Vrolijkx @macjohnny @nicokoenig