Skip to content

Optional JSON Field Creates An Error Out Of The Box #1857

Closed
@AlekseiAQ

Description

@AlekseiAQ

Description and expected behavior
Optional json field creates an error out of the box due to a different optional type check.

Screenshots
n/a

Environment (please complete the following information):

  • ZenStack version: 2.8.1
  • Prisma version: "^5.21.1"
  • Database type: Postgresql
  • Zod: "^3.23.8"

Additional context

type JSONContent {
  type String
  text String?
}
Types of property 'contentJSON' are incompatible.
        Type '{ type: string; text?: string | null | undefined; } | null | undefined' is not assignable to type 'JSONContent | null | undefined'.
          Type '{ type: string; text?: string | null | undefined; }' is not assignable to type 'JSONContent'.
            Types of property 'text' are incompatible.
              Type 'string | null | undefined' is not assignable to type 'string | undefined'.
                Type 'null' is not assignable to type 'string | undefined'.ts-plugin(2322)
index-fixed.d.ts(11664, 9): The expected type comes from property 'data' which is declared here on type 'ArticleCreateArgs<DefaultArgs>'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions