question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Setting baseclass on TypeScript clients

See original GitHub issue

I 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:closed
  • Created 6 years ago
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ddlaatcommented, Oct 31, 2019

settings.TypeScriptGeneratorSettings.ExtensionCode = "import {BaseClient} from "./baseClient";";

1reaction
ddlaatcommented, Oct 1, 2019

Thank you for the fast response. I see it now. TypeScriptGeneratorSettings is also a property of TypeScriptClientGeneratorSettings.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found