swagger-api / swagger-api/swagger-codegen-generators
[typescript-axios] Generated interfaces contain forbidden modifier async
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Description
Generated interfaces from typescript-axios when ran with the additional property withInterfaces=true contains the keyword async for methods returning Promises. However, the async modifier is not allowed in interfaces.
Compiling the resulting interfaces with tsc results in:
error TS1070: 'async' modifier cannot appear on a type member.
Swagger-codegen version
3.0.36
Swagger declaration file content or url
Command line used for generation
swagger-codegen generate -i modules/swagger-codegen/src/test/resources/3_0_0/petstore-mixed.yaml -l typescript-axios -o samples/client/petstore/typescript-axios/petstore-mixed --flatten-inline-schema=true --additional-properties=withInterfaces=true
Steps to reproduce
- Install
npm>=8.0,tsc>=4.8 andswagger-codegen=3.0.36 - Clone this repository and checkout tag
v3.0.36 - Run the following command
cdintosamples/client/petstore/typescript-axios/petstore-mixed- Run
npm install - Run
tsc
Example output:

Inspecting given lines, for example, apis/user-api.ts:670:5 shows that in fact it's a member of an interface:

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-axios generation command and the 3_0_0/petstore-mixed.yaml fixture, then inspect the generated samples/client/petstore/typescript-axios/petstore-mixed/apis/user-api.ts file. Run npm install followed by tsc and verify that generated interface members compile without the reported TS1070 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100