I'm following the React Recoil Todo List tutorial, but for some reason their are type errors when following the tutorial and I'm unsure how to satisfy them correctly.
Here is the code:
export const todoListAtom = atom({
key: 'todoListAtom',
default: [],
});
export function TodoItem({item}: {item: TodoItem}) {
const [todoList, setTodoList] = useRecoilState(todoListAtom);
const index = todoList.findIndex((listItem) => listItem === item);
const editItemText = ({target: {value}}) => {
const newList = replaceItemAtIndex(todoList, index, {
...item,
text: value,
});
setTodoList(newList);
};
The type of setTodoList is:
const setTodoList: (valOrUpdater: never[] | ((currVal: never[]) => never[])) => void