Loopback 4:将模型中的属性定义为数组

问题描述 投票:0回答:1

我有一个具有属性地址的用户模型:

@property.array(Address)
addresses: Array<Address>;

但是我收到一个错误:

Cannot start the application. Error: "items" property must be present if "type" is an array

根据Loopback documentation,我不需要做任何其他事情。

知道缺少什么吗?

typescript loopbackjs v4l2loopback
1个回答
1
投票

我们通常不会使用Array类型声明数组。以下代码适用于我们。试试看。

@property.array(Address)
addresses?: Address[];
© www.soinside.com 2019 - 2024. All rights reserved.