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.

[BUG] [typescript-angular] DELETE method - TS2554: Expected 1-2 arguments, but got 3

See original GitHub issue
Description

It generates a wrong way to call the HttpClient.delete method

openapi-generator version
5.3.1-SNAPSHOT
OpenAPI declaration file content or url
"/v1/project/{projectId}": {
  "delete": {
    "tags": [
      "Project"
    ],
    "parameters": [
      {
        "name": "projectId",
        "in": "path",
        "required": true,
        "schema": {
          "type": "string",
          "format": "uuid"
        }
      }
    ],
    "responses": {
      "200": {
        "description": "Success"
      }
    }
  }
}
Generation Details
return this.httpClient.delete<any>(`${this.configuration.basePath}/v1/project/${encodeURIComponent(String(projectId))}`,
    null, // <-- the issue
    {
        context: localVarHttpContext,
        responseType: <any>responseType_,
        withCredentials: this.configuration.withCredentials,
        headers: localVarHeaders,
        observe: observe,
        reportProgress: reportProgress
    }
);
Steps to reproduce

Generate from the DELETE method definition

Suggest a fix

In case of the DELETE method do not provide the body payload

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:19
  • Comments:26 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
matteobaldini-quixcommented, Feb 22, 2022

So just checking, a release with the proposed fixes isn’t out yet? Right? If so how can we circumvent this issue while using ng13 and openapi generator?

6reactions
coder925commented, Dec 28, 2021

Suggest a fix In case of the DELETE method do not provide the body payload

Isn’t the fix simply to use the options.body property instead (as suggested in #11172 )?

I’m actually in need of a body for DELETE.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular issue : error TS2554: Expected 0 arguments, but got 3
I know there is some issue with the constructor or with the class but i am not sure what's the issue. My recipe...
Read more >
angular viewchild expected 2 arguments Code Example
error TS2554 : Expected 2 arguments, but got 1. In Angular 8, ViewChild takes 2 parameters In Angular 9 default value is static:...
Read more >
Expected 0 arguments, but got 1 error in TypeScript | bobbyhadz
The error "Expected 0 arguments, but got 1" occurs when we pass an argument to a function that doesn't take any arguments.
Read more >
Number of Arguments in a Service is not what Angular ...
I tried to construct a function in a service that calls an API via HTTP, and returns ... error TS2554: Expected 2-8 arguments,...
Read more >
The starting point for learning TypeScript
TypeScript Documentation. Get Started. Quick introductions based on your background or preference. TS for the New Programmer · TypeScript for JS ...
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