reactive-forms icon indicating copy to clipboard operation
reactive-forms copied to clipboard

Integrate with Angular 14 typed forms

Open CristhianParra opened this issue 3 years ago • 5 comments

Description

Now that https://github.com/angular/angular/issues/13721 was finally solved, I think there's no longer a need for extra typings here, this project will still be useful for the additional helpers provided, but now it should be possible to leverage the type inference part to angular

Proposed solution

Delete duplicated types files

Alternatives considered

Keep the types duplicated, if current angular API is not suitable for integration with the other features of this package

Do you want to create a pull request?

No

CristhianParra avatar Jun 08 '22 04:06 CristhianParra

I wonder if we could have a migration to migrate back to Angular forms.

undsoft avatar Jun 09 '22 18:06 undsoft

It's not exactly the same. Angular doesn't have the ControlsOf helper, for example.

NetanelBasal avatar Jun 10 '22 13:06 NetanelBasal

Based on my experience so far, it's easier to migrate from @ngneat/reactive-forms to ng 14 strongly typed forms than it is from ng 13 @angular/forms. Migrating from ng 13 keeps the prior lack of typing, but migrating from reactive-forms keeps the strong typing. I found it useful to replace:

import { FormControl, FormGroup } from '@ngneat/reactive-forms';
import { ValuesOf } from '@ngneat/reactive-forms/lib/types';

with

import { FormControl, FormGroup, ɵFormGroupRawValue as ValuesOf } from '@angular/forms';

I'm a fan of the @ngneat projects, but I'm also happy to reduce layers when possible.

johncrim avatar Jul 01 '22 23:07 johncrim

This library developer experience is a more thoughtful than what Angular team done. Hope they will take this project in consideration somehow.

maximLyakhov avatar Jul 12 '22 10:07 maximLyakhov

This post on Medium may share a way to leverage ControlsOf with the new Angular strongly-typed forms

AKlaus avatar Aug 04 '22 02:08 AKlaus