OpenAPITools / OpenAPITools/openapi-generator
[REQ] [typescript-fetch] Make code compile with "erasableSyntaxOnly": true
Nobody has claimed this yet.
- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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