[AAE-622] No implicit returns (#5157)

* enable noImplicitReturns rule

* type fixes

* fix return types

* fix return value

* fix tests

* fix visibility service

* update tests

* add missing types

* fix test
This commit is contained in:
Denys Vuika
2019-10-17 09:35:39 +01:00
committed by GitHub
parent 48aca2d30f
commit d7ab0417b8
65 changed files with 366 additions and 319 deletions

View File

@@ -98,7 +98,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
}
}
checkUserAndValidateForm(list, value) {
checkUserAndValidateForm(list: UserProcessModel[], value: string): void {
const isValidUser = this.isValidUser(list, value);
if (isValidUser || value === '') {
this.field.validationSummary.message = '';
@@ -111,7 +111,7 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
}
}
isValidUser(users: UserProcessModel[], name: string) {
isValidUser(users: UserProcessModel[], name: string): boolean {
if (users) {
return users.find((user) => {
const selectedUser = this.getDisplayName(user).toLocaleLowerCase() === name.toLocaleLowerCase();
@@ -119,8 +119,9 @@ export class PeopleWidgetComponent extends WidgetComponent implements OnInit {
this.peopleSelected.emit(user && user.id || undefined);
}
return selectedUser;
});
}) ? true : false;
}
return false;
}
getDisplayName(model: UserProcessModel) {

View File

@@ -202,7 +202,7 @@ describe('UploadWidgetComponent', () => {
}));
it('should update the form after deleted a file', async(() => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
if (file.name === 'file-fake.png') {
return of(fakePngAnswer);
}
@@ -210,6 +210,8 @@ describe('UploadWidgetComponent', () => {
if (file.name === 'file-fake.jpg') {
return of(fakeJpgAnswer);
}
return of();
});
uploadWidgetComponent.field.params.multiple = true;
@@ -230,7 +232,7 @@ describe('UploadWidgetComponent', () => {
}));
it('should set has field value all the files uploaded', async(() => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file) => {
spyOn(contentService, 'createTemporaryRawRelatedContent').and.callFake((file: any) => {
if (file.name === 'file-fake.png') {
return of(fakePngAnswer);
}
@@ -238,6 +240,8 @@ describe('UploadWidgetComponent', () => {
if (file.name === 'file-fake.jpg') {
return of(fakeJpgAnswer);
}
return of();
});
uploadWidgetComponent.field.params.multiple = true;