I recently updated to the latest version of this package and Angular.
I checked the playground demo project in the source codes and every config is the same as mine (I'm using NX).
When unit testing, I get this error:
TypeError: Class constructor FormControl cannot be invoked without 'new'
at new FormControl (../../libs/reactive-forms/src/lib/form-control.ts:51:5)
at new FormComponent (src/app/form.component.ts:36:13)`
My code:
import { CommonModule } from '@angular/common';
import { Component, NgModule } from '@angular/core';
import { Validators } from '@angular/forms';
import { FormGroup, FormControl, ControlsOf } from '@ngneat/reactive-forms';
export interface Props {
name: string;
image: string;
}
@Component({
selector: 'app-form',
templateUrl: './form.component.html',
styleUrls: ['./form.component.scss'],
})
export class FormComponent {
formGroup: FormGroup<ControlsOf<Props>>;
constructor() {
this.formGroup= new FormGroup<ControlsOf<Props>>({
// X <- Error points to there
name: new FormControl('', [Validators.required, Validators.minLength(4), Validators.maxLength(16)]),
image: new FormControl("", Validators.required),
});
}
}
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
TypeError: Class constructor FormControl cannot be invoked without 'new'
at new FormControl (../../libs/reactive-forms/src/lib/form-control.ts:51:5)
at new FormComponent (src/app/form.component.ts:36:13)`
Please provide the environment you discovered this bug in
Is this a regression?
Yes
Description
I recently updated to the latest version of this package and Angular. I checked the playground demo project in the source codes and every config is the same as mine (I'm using NX). When unit testing, I get this error:
My code:
My unit test:
Please provide a link to a minimal reproduction of the bug
No response
Please provide the exception or error you saw
Please provide the environment you discovered this bug in
Anything else?
Sorry I couldn't provide a reproducing repo because this is a private project. but if you guys needed, I will create one.
Do you want to create a pull request?
No