swagger-api / swagger-api/swagger-codegen

Module '"@angular/core"' has no exported member 'OpaqueToken'

Open
#12,029 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

TypeScript code generated from swagger.json as part of MSBuild process using this in the csproj:

  <Target Name="NSwag" BeforeTargets="Compile" Outputs="$(ProjectDir)/src/app/code/api.ts"  Condition="Exists('$(ProjectDir)swagger.json')">
    <Message Importance="High" Text="Generating Api.ts from swagger.json." />
    <Exec Command="$(NSwagExe_net60) openapi2tsclient /input:swagger.json /output:$(ProjectDir)/client/src/app/code/api.ts /ClassName:Api /Template:Angular /RxJsVersion:7.8" />
  </Target>

However the resulting output doesn't even build let alone run.

Error: src/app/code/api.ts:13:40 - error TS2305: Module '"@angular/core"' has no exported member 'OpaqueToken'.

Also

Error: src/app/code/api.ts:146226:5 - error TS4114: This member must have an 'override' modifier because it overrides a member in the base class 'Error'.

146226     message: string;
           ~~~~~~~

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 client/src/app/code/api.ts and the NSwag target in the csproj, then trace the Angular template used by the /Template:Angular option. Check how the generated code references OpaqueToken and declares the Error-derived message member. Done means the generated TypeScript builds without these Angular and override errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.