Skip to content

FormBuilder Date problems in v.3 #109

Closed
@strigefleur

Description

Is this a regression?

Yes

Description

Having the code like

interface TestDateModel {
  id: number;
  content: string;
  date: Date;
}
//...
const obj: TestDateModel = {
  id: 1,
  content: 'pew',
  date: new Date(),
};
const f = this.formBuilder.group(obj);

gives compiler error.

Commenting out the Date typed prop "helps".

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

Error: src/app/components/test.component.ts:27:38 - error TS2345: Argument of type 'TestDateModel' is not assignable to parameter of type 'Controls<{ id: number; content: string; date: Date; }>'.
  Types of property 'date' are incompatible.
    Type 'Date' is missing the following properties from type 'FormGroup<Controls<Date>>': controls, value, valueChanges, touchChanges, and 77 more.

Please provide the environment you discovered this bug in

"@ngneat/reactive-forms": "^3.0.0",
"@angular/core": "~12.2.10",
"typescript": "~4.3.5",
"rxjs": "6.6.7",

Anything else?

Sorry, can't provide quick reproduction - StackBlitz still have @ngneat/reactive-forms v.2.0 cached.

Last version we used before 3.0 was ~1.7.3

Do you want to create a pull request?

No

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions