acacode / acacode/swagger-typescript-api

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

Aperta
#330 1 commento 2 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
TypeScript
Stelle
4.1k
Fork
436
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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?

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.