[typescript-angular] Bug - Parameters named "localVarHeaders" cause conflict.
See original GitHub issueI 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:
- Created 2 years ago
- Reactions:8
- Comments:7 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Not a great forever solution, but short term
openapi-generator-cli version-manager set 5.1.0
worksI 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.