fix typing

This commit is contained in:
Dan Percic 2022-03-09 11:20:07 +02:00
parent 903a6288de
commit a6c4093d35
2 changed files with 3 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import { AutoUnsubscribe, hasFormChanged } from '../utils';
@Directive()
export abstract class BaseFormComponent extends AutoUnsubscribe {
form!: FormGroup;
initialFormValue;
initialFormValue!: Record<string, string>;
get changed(): boolean {
return hasFormChanged(this.form, this.initialFormValue);

View File

@ -34,11 +34,11 @@ export function trackByFactory<T extends ITrackable>() {
return (index: number, item: T): string => item.id;
}
export function hasFormChanged(form: FormGroup, initialFormValue): boolean {
export function hasFormChanged(form: FormGroup, initialFormValue: Record<string, string>): boolean {
if (form && initialFormValue) {
for (const key of Object.keys(form.getRawValue())) {
const initialValue = initialFormValue[key];
const updatedValue = form.get(key).value;
const updatedValue = form.get(key)?.value;
if (initialValue == null && updatedValue != null) {
const updatedValueType = typeof updatedValue;