Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi committed Mar 28, 2020
1 parent 0b0af37 commit 5082f74
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/app/shared/abstract/service/editors/editor.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { FormControl } from '@angular/forms';
import { FormGroup } from 'ngx-typesafe-forms';
import { FormGroup, FormControl } from 'ngx-typesafe-forms';
import { Observable } from 'rxjs';
import { MysqlError } from 'mysql';

Expand Down Expand Up @@ -31,7 +30,7 @@ export abstract class EditorService<T extends TableRow> extends SubscriptionHand
get error(): MysqlError { return this._error; }

constructor(
protected _entityClass: Class,
protected _entityClass: Class<T>,
protected _entityTable: string,
protected _entityIdField: string,
protected handlerService: HandlerService<T>,
Expand All @@ -50,9 +49,9 @@ export abstract class EditorService<T extends TableRow> extends SubscriptionHand
protected abstract updateFullQuery();
protected abstract onReloadSuccessful(data: T[], id: string|number);

private getClassAttributes(c: Class): StringKeys<T>[] {
private getClassAttributes(c: Class<T>): StringKeys<T>[] {
const tmpInstance = new c();
return Object.getOwnPropertyNames(tmpInstance) as any;
return Object.getOwnPropertyNames(tmpInstance) as StringKeys<T>[];
}

protected disableEntityIdField() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/types/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface QueryForm {
};
}

export type Class = new(...args: any[]) => any;
export type Class<T> = new(...args: any[]) => T;

export interface MysqlResult<T extends TableRow> {
results?: T[];
Expand Down

0 comments on commit 5082f74

Please sign in to comment.