swagger-api / swagger-api/swagger-codegen
Typescript-node - TS2300: Duplicate identifier 'default`
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I installed swagger-codegen@2 on a mac to make sure that typescript-node was included as a language. When generating a typescript-node client I get the following errors:
protected authentications = {
'default': <Authentication>new VoidAuth(),
'default': new OAuth(),
}
error TS2300: Duplicate identifier ''default''
Which I think in turn causes
public setDefaultAuthentication(auth: Authentication) {
this.authentications.default = auth;
}
error TS2322: Type 'Authentication' is not assignable to type 'OAuth'.
Property 'accessToken' is missing in type 'Authentication'.
Swagger-codegen version
V2.4.1
Swagger declaration file content or url
I cannot provide the complete JSON as it is private but I could provide a snippet if I can get a pointer as to where there might be an issue.
Command line used for generation
swagger-codegen generate -i swagger.json -l typescript-node
Steps to reproduce
As above
Related issues/PRs
Suggest a fix/enhancement
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
Reproduce the issue with the swagger-codegen generate -i swagger.json -l typescript-node command and inspect the generated authentications block. Use a Swagger declaration that produces both default entries, then verify the generated client has no duplicate identifier and that setDefaultAuthentication type-checks.
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
- Needs clarification
- Newbie friendliness
- 25/100