Setting baseclass on TypeScript clients
See original GitHub issueI would like to provide the generated clients with a baseclass so they can call this.getBaseUrl() as the url they need to call is only known at deployment time. I will use aurelia-configuration to provide the url at that time. I can make the base client but the code does not compile since a
import { ClientBase } from './client-base';
is missing from the head of the generated file.
I am using msbuild like this
<Exec Command="$(NSwagExe) swagger2tsclient /input:swagger.json /output:src/server/backendservice.ts /UseGetBaseUrlMethod:true /ClientBaseClass:ClientBase" />
Am I doing this wrong? If this is currently not supported, would it make sense for the generator to infer the filename from the base class name?
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Setting baseclass on TypeScript clients · Issue #1011
I would like to provide the generated clients with a baseclass so they can call this.getBaseUrl() as the url they need to call...
Read more >Handbook - Classes
One of the most fundamental patterns in class-based programming is being able to extend existing classes to create new ones using inheritance.
Read more >How To Use Classes in TypeScript
This tutorial will go through the syntax used to create classes, the different features available, and how classes are treated in TypeScript ......
Read more >BaseComponent class
The base class for client-side components such as BaseClientSideWebPart or BaseExtension. In this article. Remarks; Properties; Methods; Property Details ...
Read more >Include properties from base class when using Reinforced. ...
I just figured out the solution - you need to apply the [TsClass] attribute to both the parent and child classes and the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
settings.TypeScriptGeneratorSettings.ExtensionCode = "import {BaseClient} from "./baseClient";";
Thank you for the fast response. I see it now. TypeScriptGeneratorSettings is also a property of TypeScriptClientGeneratorSettings.