question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[typescript-angular] Bug - Parameters named "localVarHeaders" cause conflict.

See original GitHub issue

I get the following error when building my Angular v11 project:

Error: src/app/core/generated-sources/api/payment.service.ts:1066:7 - error TS2769: No overload matches this call.
  Overload 1 of 15, '(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }): Observable<...>', gave the following error.
    Argument of type '{ responseType: any; withCredentials: boolean | undefined; localVarHeaders: HttpHeaders; observe: any; reportProgress: boolean; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.
      Object literal may only specify known properties, and 'localVarHeaders' does not exist in type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "events"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.       
  Overload 2 of 15, '(url: string, body: any, options: { headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }): Observable<...>', gave the following error.        
    Argument of type '{ responseType: any; withCredentials: boolean | undefined; localVarHeaders: HttpHeaders; observe: any; reportProgress: boolean; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.
      Object literal may only specify known properties, and 'localVarHeaders' does not exist in type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe: "response"; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.     
  Overload 3 of 15, '(url: string, body: any, options?: { headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe?: "body" | undefined; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; } | undefined): Observable<...>', gave the following error.
    Argument of type '{ responseType: any; withCredentials: boolean | undefined; localVarHeaders: HttpHeaders; observe: any; reportProgress: boolean; }' is not assignable to parameter of type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe?: "body" | undefined; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.
      Object literal may only specify known properties, and 'localVarHeaders' does not exist in type '{ headers?: HttpHeaders | { [header: string]: string | string[]; } | undefined; observe?: "body" 
| undefined; params?: HttpParams | { [param: string]: string | string[]; } | undefined; reportProgress?: boolean | undefined; responseType?: "json" | undefined; withCredentials?: boolean | undefined; }'.

1066       localVarHeaders: localVarHeaders,
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:8
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
Alec13355commented, Aug 26, 2021

Not a great forever solution, but short term openapi-generator-cli version-manager set 5.1.0 works

0reactions
wing328commented, Aug 31, 2021

I think you can also workaround the issue by using customized templates (e.g. -t in the CLI option). Please refer to the project’s readme on how to do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI Generator typescript-angular generates failing services
26") I am getting failing angular services (Angular Verision 13.2.0). Eg. they pass to many arguments to the Angular HttpClient so that the...
Read more >
Documentation for the typescript-angular Generator
Property, Value, Notes. generator name, typescript-angular, pass this to the generate command after -g. generator stability, STABLE. generator type, CLIENT.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found