fix typing
This commit is contained in:
parent
903a6288de
commit
a6c4093d35
@ -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);
|
||||
|
||||
@ -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;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user