typescript reports errors with FormData since 13.0.10
I'm experiencing TypeScript errors that come from the generated http-client.ts.
Here are the errors:
My build passes with version 13.0.10 of swagger-typescript-api but not with version 13.0.11.
By comparing the 2 generated files, here are the differences I obtain:
The file on the left is the one generated by swagger-typescript-api version 13.0.11. It has TypeScript errors.
The file on the right does not have TypeScript error.
My project uses version 5.2 of typescript.
I think the bug is introduced by this commit: https://github.com/acacode/swagger-typescript-api/commit/0d80f8e6ea5a2420745841f8b9eb95faae0b4ffc
Provide specific reproducible example.
Hey,
I'm wondering what the intention of this change is. If I need to pass in an instance of FormData as the request body, why do I need the formatter then? It just recreates the FormData instance again (and possibly loses information, because it e.g. does not support he third parameter of FormData.prototype.append).
For me the main use case of this formatter was, that I can pass in a plain object, that is transformed to a FormData instance. This is broken (by-design?) now, but imho shouldn't have happened in a patch release.
Hello @jeremyriverain ,
I guess you have to add "dom.iterable" into your tsconfig:
"compilerOptions": { "lib": ["esNext", "dom", "dom.iterable"],
Hi I second this bug. After the update the autogenerated code is generating in the http-client new code with Array.from instead of Object.keys.
This then brings the same error as Jeremy.
I had already in my compilerOptions the "dom.iterable"
Same issue occurs with 13.0.12.
I renamed the file from http-client.ts to api.d.ts and the error disappeared
I am wondering - will it just stay as it is? It is a breaking change in a patch version, right?
I don't think it was a breaking change, it was really just a fix. If someone could share a minimal reproduction example, I will take a look at it and provide some pointers.
I've created a reproducible example here: benvd/swagger-typescript-api-814.
@benvd Indeed! It was definitely a bug! I will revert the PR and release it as 13.0.16.
https://github.com/acacode/swagger-typescript-api/releases/tag/13.0.16