Support arrays of objects #148
Replies: 2 comments 5 replies
-
would adding |
Beta Was this translation helpful? Give feedback.
-
Hi, @stefanprobst. While we've added the array support for primitive values (#113), we don't currently support arrays of objects as shown above. Adding those TypeScript changes will satisfy type-checking but we won't parse such model definition correctly. Overall, we'd have to think about the expectations here. Plain values must use gettersIf you have a model which property is an array of plain values (numbers, strings), it must use a value getter: factory({
user: {
numbers: () => [1, 2, 3]
}
}) This will both infer the type of Arrays of objects become confusingfactory({
dataset: {
contributors: [
{ actor: oneOf('actor'), role: oneOf('role') }
]
}
}) Here, This raises a series of questions:
|
Beta Was this translation helpful? Give feedback.
-
hi, i was wondering if arrays of objects are (yet) supported? i am getting a type error when trying out the following:
thanks!
Beta Was this translation helpful? Give feedback.
All reactions