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

@ -0,0 +1,10 @@
export class AccountBalance {
date: number;
total: number;
public constructor(init?: Partial<AccountBalance>) {
this.date = 0;
this.total = 0;
Object.assign(this, init);
}
}

View File

@ -4,6 +4,7 @@ import { Observable } from 'rxjs/internal/Observable';
import { catchError } from 'rxjs/operators';
import { Account } from './account';
import { AccountBalance } from './account-balance';
import { ErrorLoggerService } from './error-logger.service';
const httpOptions = {
@ -92,11 +93,11 @@ export class AccountService {
);
}
balance(id: string, date: string): Observable<any> {
balance(id: string, date: string): Observable<AccountBalance> {
const options = { params: new HttpParams().set('d', date) };
return <Observable<any>>(
return <Observable<AccountBalance>>(
this.http
.get<any>(`${url}/${id}/balance`, options)
.get<AccountBalance>(`${url}/${id}/balance`, options)
.pipe(catchError(this.log.handleError(serviceName, 'balance')))
);
}

View File

@ -19,7 +19,7 @@ export class ErrorLoggerService {
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars, class-methods-use-this
public handleError<T>(serviceName = 'error-logger', operation = 'operation', result?: T) {
return (error: any): Observable<T> => {
return (error: unknown): Observable<T> => {
ErrorLoggerService.log(serviceName, `${operation} failed: ${error}`);
return throwError(error);
};

View File

@ -19,7 +19,7 @@ export class ErrorInterceptor implements HttpInterceptor {
private toaster: ToasterService,
) {}
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
return next.handle(request).pipe(
catchError((err) => {
// We don't want to refresh token for some requests like login or refresh token itself

View File

@ -0,0 +1,14 @@
export class IssueGridItem {
id: string;
amount: number;
source: string;
destination: string;
public constructor(init?: Partial<IssueGridItem>) {
this.id = '';
this.amount = 0;
this.source = '';
this.destination = '';
Object.assign(this, init);
}
}

View File

@ -10,7 +10,7 @@ export class JwtInterceptor implements HttpInterceptor {
constructor(private authService: AuthService) {}
intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
intercept(request: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
// add authorization header with jwt token if available
// We use this line to debug token refreshing