I'm a beginner when it comes to reactive forms. I'm currently working on assigning form values (which are all string inputs) from my reactive form to a variable that is an object of strings. However, I am encountering the following error:
"Type 'Partial<{ taskName: string | null; taskDate: string | null; taskPriority: string | null; }>' is not assignable to type 'ToDoDetailType'. Types of property 'taskName' are incompatible. Type 'string | null | undefined' is not assignable to type 'string'. Type 'undefined' is not assignable to type 'string'."
export class ToDoMakerComponent implements OnInit{
ngOnInit(): void {
}
toDoForm = new FormGroup({
taskName : new FormControl<string>('',[Validators.required]),
taskDate : new FormControl('',[Validators.required]),
taskPriority : new FormControl('',[Validators.required])
})
toDoDetail:ToDoDetailType | undefined;
onSubmit(){
console.log(this.toDoForm.value);
this.toDoDetail = this.toDoForm.value //error raising line
}
}
export interface ToDoDetailType{
taskName: string,
taskDate: string,
taskPriority: string
}