OpenAPITools / OpenAPITools/openapi-generator

[BUG] [Typescript] Generic type 'URLParse<Query>' requires 1 type argument(s).

Open
#12,625 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Bug Report Checklist
  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Contrary to v5.4.0, the generate http/http.ts does not include the @ts-ignore comment and as such fail type checking:

./node_modules/.../http/http.ts:44:18
Type error: Generic type 'URLParse<Query>' requires 1 type argument(s).

  42 |     private headers: { [key: string]: string } = {};
  43 |     private body: RequestBody = undefined;
> 44 |     private url: URLParse;
     |                  ^
  45 |
  46 |     /**
  47 |      * Creates the request context using a http method and request resource url
info  - Checking validity of types .%

(tested with url-parse types 1.4.8. I get other errors with 1.4.4)

openapi-generator version

v6.0.0

OpenAPI declaration file content or url

N/A

Generation Details

N/A

Steps to reproduce
Related issues/PRs

Introduced in https://github.com/OpenAPITools/openapi-generator/pull/11465

Suggest a fix

Add back the // @ts-ignore?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated http/http.ts file and the change introduced by pull request 11465. Reproduce TypeScript checking with url-parse types 1.4.8 and compare the generated output with v5.4.0. Done means the generated client passes type checking without the URLParse generic-argument error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.