aotoyae

[TS] fullcalendar ERROR : 이 호출과 일치하는 오버로드가 없습니다. 본문

TypeScript

[TS] fullcalendar ERROR : 이 호출과 일치하는 오버로드가 없습니다.

aotoyae 2024. 3. 20. 22:36

 

 

💡 events 데이터 타입 에러 해결

 

<FullCalendar
  initialView="dayGridMonth"
  plugins={[dayGridPlugin]}
  events={todos} // supabase 에서 가져온 데이터
/>

 

supabase 에서 가져온 투두 리스트를 캘린더에 넣었더니 이런 에러가 떴다.

fakeData 로는 안뜨더니?!

 

// fakeData
{
  title: '아침 먹기',
  start: '2024-03-17',
  end: '2024-03-17',
},

//supabaseData
{
  contents: string | null;
  created_at: string;
  end: string;
  file: string | null;
  likeCount: number | null;
  liked: boolean | null;
  nickname: string | null;
  start: string;
  title: string;
  todoId: string;
};

 

찾아보니 fullcalendar 에서 events 에 정해둔 속성들이 있어서

supabase 에서 가져온 데이터 중 쓸 것들만 다시 골라내기로 했다.

const todos: TodosInCalendar = [];

data?.map((item) =>
  todos.push({
    title: item.title,
    start: item.start,
    end: item.end,
  })
);

평온..

 

🥹 쉬운거 같으면서 어려운 fullcalendar..