Skip to content

Generated nested object types #248

@r1chm8

Description

@r1chm8

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions