updated get method to receive generic params
This commit is contained in:
parent
a81e22c083
commit
64bf1b270d
@ -24,11 +24,12 @@ export abstract class GenericService<I> {
|
||||
|
||||
protected constructor(protected readonly _injector: Injector, protected readonly _defaultModelPath: string) {}
|
||||
|
||||
get(): Observable<I[]>;
|
||||
get(id: string, ...args: unknown[]): Observable<I>;
|
||||
get<T = I[]>(): Observable<T>;
|
||||
// eslint-disable-next-line @typescript-eslint/unified-signatures
|
||||
get<T = I>(id: string, ...args: unknown[]): Observable<T>;
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
||||
get(id?: string, ...args: unknown[]): Observable<I | I[]> {
|
||||
return id ? this._getOne([id]) : this.getAll();
|
||||
get<T>(id?: string, ...args: unknown[]): Observable<T> {
|
||||
return id ? this._getOne<T>([id]) : this.getAll<T>();
|
||||
}
|
||||
|
||||
getAll<R = I[]>(modelPath = this._defaultModelPath, queryParams?: List<QueryParam>): Observable<R> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user