ngneat / reactive-forms

(Angular Reactive) Forms with Benefits 😉
https://www.netbasal.com
611 stars 56 forks source link

Integrate with Angular 14 typed forms #163

Open CristhianParra opened 2 years ago

CristhianParra commented 2 years ago

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

undsoft commented 2 years ago

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

NetanelBasal commented 2 years ago

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

johncrim commented 2 years ago

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.

maximLyakhov commented 2 years ago

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

AKlaus commented 2 years ago

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