Skip to content

Commit

Permalink
fix(adapter-commons): Return missing overloads (#2203)
Browse files Browse the repository at this point in the history
  • Loading branch information
vonagam authored Feb 5, 2021
1 parent 423db79 commit bbe7e2a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/adapter-commons/src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ export class AdapterService<T = any> implements ServiceMethods<T|Paginated<T>> {
return callMethod(this, '_get', id, params);
}

create (data: Partial<T>, params?: Params): Promise<T>;
create (data: Partial<T>[], params?: Params): Promise<T[]>;
create (data: Partial<T> | Partial<T>[], params?: Params): Promise<T | T[]>;
create (data: Partial<T> | Partial<T>[], params?: Params): Promise<T | T[]> {
if (Array.isArray(data) && !this.allowsMulti('create')) {
return Promise.reject(new MethodNotAllowed('Can not create multiple entries'));
Expand All @@ -189,6 +192,9 @@ export class AdapterService<T = any> implements ServiceMethods<T|Paginated<T>> {
return callMethod(this, '_update', id, data, params);
}

patch (id: Id, data: Partial<T>, params?: Params): Promise<T>;
patch (id: null, data: Partial<T>, params?: Params): Promise<T[]>;
patch (id: NullableId, data: Partial<T>, params?: Params): Promise<T | T[]>;
patch (id: NullableId, data: Partial<T>, params?: Params): Promise<T | T[]> {
if (id === null && !this.allowsMulti('patch')) {
return Promise.reject(new MethodNotAllowed('Can not patch multiple entries'));
Expand All @@ -197,6 +203,9 @@ export class AdapterService<T = any> implements ServiceMethods<T|Paginated<T>> {
return callMethod(this, '_patch', id, data, params);
}

remove (id: Id, params?: Params): Promise<T>;
remove (id: null, params?: Params): Promise<T[]>;
remove (id: NullableId, params?: Params): Promise<T | T[]>;
remove (id: NullableId, params?: Params): Promise<T | T[]> {
if (id === null && !this.allowsMulti('remove')) {
return Promise.reject(new MethodNotAllowed('Can not remove multiple entries'));
Expand Down

0 comments on commit bbe7e2a

Please # to comment.