How can I fix type does not exist error
export interface TaskBase extends CamelCase<BlueprintChecklistInsert> {
errorMessage?: string;
}
export interface TasksParent extends Omit<TaskBase, 'parent_id'> {
children: TaskBase[];
}
type BlueprintChecklistInsert = BluePrintCheckList['Insert'];
type BluePrintCheckListGet = BluePrintCheckList['Row'];
const sanatizeUpdatChecklistValueToDb = (values: TasksParent[] | TaskBase[]): BlueprintChecklistInsert[] => {
const checklists: BlueprintChecklistInsert[] = [];
values.forEach((el) => {
const toCamelCase = objectToSnake(el);
checklists.push(toCamelCase);
if (el.children) {
const childrenChecklist = sanatizeUpdatChecklistValueToDb(el.children);
checklists.push(...childrenChecklist);
}
return el;
});
return checklists;
};
Here, typescript is throwing
Property ‘children’ does not exist on type ‘TaskBase’
I thought doing this el.children
would fix it. but it didn’t