Fixes #6969: typescript-inversify client compile error, type casting …#6970
Fixes #6969: typescript-inversify client compile error, type casting …#6970macjohnny merged 2 commits intoOpenAPITools:masterfrom michalzubkowicz:master
Conversation
…warning and apostrophes
| if ({{paramName}} !== undefined) { | ||
| {{#isDateTime}} | ||
| queryParameters.push("{{paramName}}="+encodeURIComponent(<any>{{paramName}}.toISOString())); | ||
| queryParameters.push('{{paramName}}='+encodeURIComponent(({{paramName}} as Date).toISOString())); |
There was a problem hiding this comment.
what is the original type of {{paramName}}? can it be casted to Date without issues?
There was a problem hiding this comment.
The type of paramName normally implements Date interface so this change should be correctly.
There was a problem hiding this comment.
I think the general type for format: date-time in the typescript generators is string, see #5314
There was a problem hiding this comment.
I think the general type for
format: date-timein the typescript generators isstring, see #5314
I'm pretty sure that is Date interface here, because I'm using it this generator.
|
cc @gualtierim |
|
@michalzubkowicz thanks for your PR! |
|
Only Date data type have toISOString method, so casting itself will not be a problem, also I'm using this generator for a while after these fixes. I'll merge last master |
if it is |
You are right, this "cast" problably is not necessary, proper type should be introduced earlier, and for sure it's Date not string , because string doesn't have toISOString method. Just changed this type here to ease understanding why toISOString method is used. |
This client was unusable for long time because of typings, which fixes this PR, also I've changed apostrophes to be consistent in whole generator to more widely used (single).
fixes #6969