let todoItems: { id: number; title: string; done: boolean }[];
     
    function fetchTodos(): { id: number; title: string; done: boolean }[] {
      const todos = fetchTodoItems();
      return todos;
    }
     
    function addTodo(todo: { id: number; title: string; done: boolean }): void {
      todoItems.push(todo);
    }
     
    function completeTodo(
      index: number,
      todo: { id: number; title: string; done: boolean }
    ): void {
      todo.done = true;
      todoItems.splice(index, 1, todo);
    }
    // ...
    신간 소식 구독하기
    뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.