I need to make a deep copy of a reactive form.
I have tried with ES6 spread syntax for cloning a form. I have used Typescript generics to typecast the return value of the spread syntax to FormGroup. Also, the type of clone form variable is set to FormGroup.
But when the form is cloned by this way, the type is lost on the cloned form variable, that is, it is no longer of type of FormGroup. So, the cloned form is not usable.
Here is the stackblitz for the same: form cloning
What is going wrong in above way of cloning? Why the type FormGroup is lost on the cloned form?