data
data copied to clipboard
Generated nested object types
Hello, I'm wondering if types returned by generating data in these two different ways should be the same or not?
Example one
article: {
metadata: {
author: nullable(String),
}
},
the returned type of article.metadata.author is string | null | undefined.
Example Two
article: {
metadata: oneOf('metadata'),
},
metadata: {
author: nullable(String),
},
the returned type of article.metadata.author is string | null;
I would expect the types to be the same and I'd also expect the type to be string | null. If undefined was required, maybe a helper such as optional(nullable(String)) could be used to generate it.