acacode / acacode/swagger-typescript-api

Define instance member properties in class 'HttpClient ' as instance member methods

Open
#330 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.1k
Forks
436
PR merge metrics
No merged PRs in 30d

Description

Instead of rewriting the templates, I want to be able to extend the underlying HttpClient class, e.g.:

```
class ApiWithErrorHandling extends Api {

async request(params: FullRequestParams): Promise> {
try {
return super.request(params);
} catch (e) {
// do error handling (e.g. logout)
throw e;
}
}

}
```

which results in the following error:

`Class 'Api ' defines instance member property 'request', but extended class 'ApiWithErrorHandling' defines it as instance member function.`

Is there any reason, why the HttpClient class is designed that way?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.