Switched on the @typescript-eslint/no-non-null-assertion rule in eslint.

Fixed the errors it threw up.
This commit is contained in:
2022-07-17 09:17:20 +05:30
parent c76696e022
commit 9f70ec2917
29 changed files with 144 additions and 111 deletions
@@ -50,14 +50,14 @@ export class EmployeeFunctionsComponent {
}
chosenYearHandler(normalizedYear: Moment) {
const ctrlValue = this.creditSalaryForm.value.date!;
const ctrlValue = this.creditSalaryForm.value.date ?? moment();
ctrlValue.year(normalizedYear.year());
ctrlValue.date(ctrlValue.daysInMonth());
this.creditSalaryForm.setValue({ date: ctrlValue });
}
chosenMonthHandler(normlizedMonth: Moment, datepicker: MatDatepicker<Moment>) {
const ctrlValue = this.creditSalaryForm.value.date!;
const ctrlValue = this.creditSalaryForm.value.date ?? moment();
ctrlValue.month(normlizedMonth.month());
ctrlValue.date(ctrlValue.daysInMonth());
this.creditSalaryForm.setValue({ date: ctrlValue });
@@ -65,7 +65,7 @@ export class EmployeeFunctionsComponent {
}
creditSalary() {
const date = this.creditSalaryForm.value.date!.format('DD-MMM-YYYY');
const date = (this.creditSalaryForm.value.date ?? moment()).format('DD-MMM-YYYY');
if (!date) {
this.toaster.show('Danger', 'Please choose a valid date.');
return;
@@ -81,8 +81,10 @@ export class EmployeeFunctionsComponent {
}
attendanceRecordUrl() {
const startDate = this.attendanceRecordForm.value.startDate!.format('DD-MMM-YYYY');
const finishDate = this.attendanceRecordForm.value.finishDate!.format('DD-MMM-YYYY');
const startDate = (this.attendanceRecordForm.value.startDate ?? moment()).format('DD-MMM-YYYY');
const finishDate = (this.attendanceRecordForm.value.finishDate ?? moment()).format(
'DD-MMM-YYYY',
);
if (!startDate || !finishDate) {
// this.toaster.show('Danger', 'Please choose a start and finish date.');
return '';
@@ -91,8 +93,10 @@ export class EmployeeFunctionsComponent {
}
fingerPrintUrl() {
const startDate = this.attendanceRecordForm.value.startDate!.format('DD-MMM-YYYY');
const finishDate = this.attendanceRecordForm.value.finishDate!.format('DD-MMM-YYYY');
const startDate = (this.attendanceRecordForm.value.startDate ?? moment()).format('DD-MMM-YYYY');
const finishDate = (this.attendanceRecordForm.value.finishDate ?? moment()).format(
'DD-MMM-YYYY',
);
if (!startDate || !finishDate) {
// this.toaster.show('Danger', 'Please choose a start and finish date.');
return '';