问题描述
我有一条POST
公路收到了array
的{{1}}。我想先过滤掉它们,然后再在数据源中创建它们。
我试图这样做:
Queue
但是我得到这个错误:
async createarraywithcheck(
@requestBody(/*...*/)
queues: [Omit<Queue,'id'>],): Promise<Queue[]> {
queues = queues.filter(queue => queue.title.length < 10); //error here
return this.queueRepository.createAll(queues);
}
我不明白它们之间的区别,对我来说,它们都是Type 'Pick<Queue,"getId" | "getIdObject" | "toJSON" | "toObject" | "title">[]'
is not assignable to type
'[Pick<Queue,"getId" | "getIdObject" | "toJSON" | "toObject" |"title">]'.
Target requires 1 element(s) but source may have fewer.ts(2322)
的数组。
我该如何解决?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)