Fix binary response type to process as a Blob rather than text/string by loganbenjamin · Pull Request #986 · ferdikoomen/openapi-typescript-codegen

Just tried this branch with a newer ionic (6.x) / angular (13.2.x) app, and this works perfectly with the exception of an initial build error:

Error: src/app/_generated/openapi/core/request.ts:209:5 - error TS2322: Type 'Observable<ArrayBuffer>' is not assignable to type 'Observable<HttpResponse<T>>'.
  Type 'ArrayBuffer' is missing the following properties from type 'HttpResponse<T>': body, type, clone, headers, and 4 more.

It appears that changing this line in request.ts:

responseType: options.responseType,

To this:

responseType: options.responseType as any,

alleviates the above error, which appears to be coming from an angular/common/http type def conflict.

Once the above line was changed, Blob responses started coming back as expected with no changes to my openapi spec.

Not sure whether there's a more elegant way to handle this with generics, but hitting that line with the "any" hammer seems to do the trick for now.