Sorry , I am new to Typescript, need to pass the prop to a component after filtering , for that I have defined a simple filter method. I get compilation error saying 'Type 'IMilestone[] | undefined' is not assignable to type 'IMilestone[]'
const milestonesOfActiveGroup = ():IMilestone[] => {
return studyProgress?.groups.filter((group:IGroup) => group.name === activeGroup)[0].milestones
}
since I fetch and populate studyProgress it can be undefined right. What is the correct way to define this method?