-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Describe the Bug
According to the documentation, draft: true
prevents mandatory fields from having to be defined, but TypeScript requires them anyway:
https://payloadcms.com/docs/versions/drafts#updating-or-creating-drafts
Link to the code that reproduces this issue
https://github.com/payloadcms/payload
Reproduction Steps
- In
test/_community/collections/Posts/index.ts
, addversions: { drafts: true }
to the collection andrequired: true
to the "content" field. - Run
pnpm dev
to generate the types. - You'll see an error in the second
payload.create
of the file:test/_community/config.ts
. This error appears even if you adddraft: true
as a property topayload.create
:
Type '{ title: string; }' is not assignable to type 'Omit<Post, "id" | "sizes" | "createdAt" | "updatedAt"> & Partial<Pick<Post, "id" | "sizes" | "createdAt" | "updatedAt">>'.
Property 'content' is missing in type '{ title: string; }' but required in type 'Omit<Post, "id" | "sizes" | "createdAt" | "updatedAt">'.ts(2322)
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Payload: 3.39.1
daringcalf