OpenAPITools / OpenAPITools/openapi-generator

[REQ] [typescript-fetch] Make code compile with "erasableSyntaxOnly": true

Open
#22,400 0 comments 9 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

Describe the solution you'd like

It would be nice if the generated code could run without transpilation (eg directly executing it in node). Since Typescript 5.8. there's a compiler option to enforce this named "erasableSyntaxOnly". See https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-8.html#the---erasablesyntaxonly-option

It looks like the only problem in the generated code patterns like the following

constructor(private configuration: ConfigurationParameters = {}) {}

in the runtime.ts.

Describe alternatives you've considered

The only possible solution is to patch the runtime manually.

Additional context

As outlined above if the generated code passes "erasableSyntaxOnly": true it is possible to run it directly on NodeJS, removing the need to transpile it.

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 typescript-fetch runtime.ts and locate the generated constructor patterns using parameter properties, such as private configuration: ConfigurationParameters = {}. Verify that the generated TypeScript passes with erasableSyntaxOnly enabled and can run directly in NodeJS without transpilation.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
api
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.