-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TypeScript] Add Angular v7 support #1297
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: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 Reddit: https://www.reddit.com/r/angular/comments/9rtcyb/typescript_angular_client_generator_in/ 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.sh
and./bin/security/{LANG}-petstore.sh
if 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