Removed the use of any and enabled the rule in eslint.

Now according to me the conversion is final.
Testing is required.
This commit is contained in:
2020-11-24 08:03:43 +05:30
parent 715e35ef38
commit 2972203148
92 changed files with 610 additions and 378 deletions

View File

@ -6,11 +6,13 @@ describe('IssueDialogComponent', () => {
let component: IssueDialogComponent;
let fixture: ComponentFixture<IssueDialogComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [IssueDialogComponent],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [IssueDialogComponent],
}).compileComponents();
}),
);
beforeEach(() => {
fixture = TestBed.createComponent(IssueDialogComponent);

View File

@ -7,6 +7,7 @@ import { debounceTime, distinctUntilChanged, startWith, switchMap } from 'rxjs/o
import { Batch } from '../core/batch';
import { BatchService } from '../core/batch.service';
import { Inventory } from '../core/inventory';
import { MathService } from '../shared/math.service';
@Component({
@ -21,7 +22,7 @@ export class IssueDialogComponent implements OnInit {
constructor(
public dialogRef: MatDialogRef<IssueDialogComponent>,
@Inject(MAT_DIALOG_DATA) public data: any,
@Inject(MAT_DIALOG_DATA) public data: { inventory: Inventory; date: string },
private fb: FormBuilder,
private math: MathService,
private batchSer: BatchService,
@ -44,7 +45,7 @@ export class IssueDialogComponent implements OnInit {
batch: this.data.inventory.batch,
quantity: this.data.inventory.quantity,
});
this.batch = this.data.inventory.batch;
this.batch = this.data.inventory.batch as Batch;
}
displayFn(batch?: Batch): string {

View File

@ -1,12 +1,14 @@
import { DataSource } from '@angular/cdk/collections';
import { Observable } from 'rxjs';
export class IssueGridDataSource extends DataSource<any> {
constructor(private data: Observable<any[]>) {
import { IssueGridItem } from '../core/issue-grid-item';
export class IssueGridDataSource extends DataSource<IssueGridItem> {
constructor(private data: Observable<IssueGridItem[]>) {
super();
}
connect(): Observable<any[]> {
connect(): Observable<IssueGridItem[]> {
return this.data;
}

View File

@ -4,6 +4,7 @@ import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { ErrorLoggerService } from '../core/error-logger.service';
import { IssueGridItem } from '../core/issue-grid-item';
const url = '/api/issue-grid';
const serviceName = 'IssueGridService';
@ -14,10 +15,10 @@ const serviceName = 'IssueGridService';
export class IssueGridService {
constructor(private http: HttpClient, private log: ErrorLoggerService) {}
issueGrid(date: string): Observable<any[]> {
return <Observable<any[]>>(
issueGrid(date: string): Observable<IssueGridItem[]> {
return <Observable<IssueGridItem[]>>(
this.http
.get<any[]>(`${url}/${date}`)
.get<IssueGridItem[]>(`${url}/${date}`)
.pipe(catchError(this.log.handleError(serviceName, 'autocomplete')))
);
}

View File

@ -9,12 +9,14 @@ describe('IssueComponent', () => {
let component: IssueComponent;
let fixture: ComponentFixture<IssueComponent>;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatDialogModule, ReactiveFormsModule, RouterTestingModule],
declarations: [IssueComponent],
}).compileComponents();
}));
beforeEach(
waitForAsync(() => {
TestBed.configureTestingModule({
imports: [MatDialogModule, ReactiveFormsModule, RouterTestingModule],
declarations: [IssueComponent],
}).compileComponents();
}),
);
beforeEach(() => {
fixture = TestBed.createComponent(IssueComponent);

View File

@ -14,6 +14,7 @@ import { Batch } from '../core/batch';
import { BatchService } from '../core/batch.service';
import { CostCentre } from '../core/cost-centre';
import { Inventory } from '../core/inventory';
import { IssueGridItem } from '../core/issue-grid-item';
import { ToasterService } from '../core/toaster.service';
import { User } from '../core/user';
import { Voucher } from '../core/voucher';
@ -35,7 +36,7 @@ export class IssueComponent implements OnInit, AfterViewInit, OnDestroy {
@ViewChild('batchElement', { static: true }) batchElement?: ElementRef;
@ViewChild('dateElement', { static: true }) dateElement?: ElementRef;
public inventoryObservable = new BehaviorSubject<Inventory[]>([]);
public gridObservable = new BehaviorSubject<any[]>([]);
public gridObservable = new BehaviorSubject<IssueGridItem[]>([]);
dataSource: IssueDataSource = new IssueDataSource(this.inventoryObservable);
gridDataSource: IssueGridDataSource = new IssueGridDataSource(this.gridObservable);
form: FormGroup;