我刚刚开始使用打字稿,我希望你能帮助我,我不知道如何解决这个错误
\n\n接口
\n\nexport interface IProduct {\n name: string;\n price: number[];\n stock: number;\n createdAt: firestore.Timestamp\n}\n\nexport interface IDataProduct {\n [key: string]: IProduct\n}\nRun Code Online (Sandbox Code Playgroud)\n\n从 firestore 获取 ProductList
\n\nexport const fetchProducts = () => \n async (dispatch: Dispatch, getState: () => any, { db }: IServices) => { \n try {\n const snaps = await db.collection(\'productos\').get()\n\n let products: IDataProduct = {}\n snaps.forEach(x => {\n return products[x.id] = x.data()\n })\n\n dispatch(fetchSucess(products))\n } catch (error) { dispatch(fetchError(error)) }\n}\nRun Code Online (Sandbox Code Playgroud)\n\n错误\n “类型\'DocumentData\'无法分配给类型\'IProduct\'。\n类型\'DocumentData\'缺少类型\'IProduct\'中的以下属性:name、precio、stock、createdAt …