Open Source Wealth Management Software. Angular + NestJS + Prisma + Nx + TypeScript 🤍
TypeScript angularetffinancefintechghostfoliohacktoberfestinvestingnestjsosspersonal-financeportfolioprismasoftwarestocktrackertradingtypescriptwealth-managementweb
Task/improve type safety in rule settings dialog component (#7185)
Kenrick Tandrian0cbb8f111680
diff --git a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.tsindex 74cc80f269..4b2a9b0e65 100644--- a/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts+++ b/apps/client/src/app/components/rule/rule-settings-dialog/rule-settings-dialog.component.ts@@ -1,6 +1,6 @@import { GfValueComponent } from '@ghostfolio/ui/value';-import { ChangeDetectionStrategy, Component, Inject } from '@angular/core';+import { ChangeDetectionStrategy, Component, inject } from '@angular/core';import { FormBuilder, FormGroup, ReactiveFormsModule } from '@angular/forms';import { MatButtonModule } from '@angular/material/button';import {@@ -26,20 +26,21 @@ import { RuleSettingsDialogParams } from './interfaces/interfaces';templateUrl: './rule-settings-dialog.html'})export class GfRuleSettingsDialogComponent {- public settingsForm: FormGroup;+ protected readonly settingsForm: FormGroup;- public constructor(- @Inject(MAT_DIALOG_DATA) public data: RuleSettingsDialogParams,- public dialogRef: MatDialogRef<GfRuleSettingsDialogComponent>,- private formBuilder: FormBuilder- ) {+ protected readonly data = inject<RuleSettingsDialogParams>(MAT_DIALOG_DATA);+ protected readonly dialogRef =+ inject<MatDialogRef<GfRuleSettingsDialogComponent>>(MatDialogRef);+ private readonly formBuilder = inject(FormBuilder);++ public constructor() {this.settingsForm = this.formBuilder.group({- thresholdMax: [this.data.settings.thresholdMax],- thresholdMin: [this.data.settings.thresholdMin]+ thresholdMax: [this.data.settings?.thresholdMax],+ thresholdMin: [this.data.settings?.thresholdMin]});}- public onSubmit() {+ protected onSubmit() {this.dialogRef.close({...this.data.settings,thresholdMax: this.settingsForm.get('thresholdMax')?.value,