【发布时间】:2022-01-06 04:04:22
【问题描述】:
我有这个:
const res: any = await table.find({}).toArray();
const data: Type[] = res;
有没有办法做这样的事情:
const res: Type[] = await table.find({}).toArray();
没有错误:Type 'Document[]' is not assignable to type 'Type[]'. ?
【问题讨论】:
-
我认为你应该使用filter 来做到这一点。
标签: typescript mongoose types