I have a type:
type OtpCode = {
one: string;
two: string;
three: string;
four: string;
five: string;
six: string;
};
and try to loop this object and set value :
Object.keys(defaultValues).forEach((x, i) => {
codeValuesForm.setValue(x, 'sometesttext');
});
x Type is OtpCode, and Typescript tells me that
Argument of type 'string' is not assignable to parameter of type '"one" | "two" | "three" | "four" | "five" | "six"'.
How can I solve this to loop this object?