Tengo la siguiente instantánea:
const [tasks, setTasks] = useState<[ITask]|[]>([]); useEffect(() => { onSnapshot(q, (snapshop) => { setTasks( snapshop.docs.map((doc) => ({ ...doc.data(), id: doc.id, timestamp: doc.data().timestamp?.toDate().getTime(), })) ); setLoading(false); }); }, []);y la siguiente interfaz:
interface ITask { id: string; foo: string; bar: string; timestamp: number; }Esto me da este error:
Argument of type '{ id: string; timestamp: any; }[]' is not assignable to parameter of type 'SetStateAction<[ITask] | []>'. Type '{ id: string; timestamp: any; }[]' is not assignable to type '(prevState: [ITask] | []) => [ITask] | []'. Type '{ id: string; timestamp: any; }[]' provides no match for the signature '(prevState: [ITask] | []): [ITask] | []'. Puedo leer y entender el error, pero no sé cómo resolver este problema. ¿Cómo puedo saber qué es doc.data() ?