Skip to content

Local API Update Inferred Types should be Partial<> #2009

@xHomu

Description

@xHomu

Bug Report

Payload allows for updating doc with only partial data, but the inferred type requires the whole collection object:

image
image

Steps to Reproduce

  1. Create a document
  2. Update document using Local API with partial data
  3. Typescript errors, but the update posted correctly by Payload.

Other Details

Payload v1.16.3

This can be fixed by changing from MarkOptional<GeneratedTypes['collections'][TSlug], 'id' | 'updatedAt' | 'createdAt'> to Partial<GeneratedTypes['collections'][TSlug]>:

https://github.com/payloadcms/payload/blob/master/src/collections/operations/local/update.ts#LL16

Posted a PR #2010

Metadata

Metadata

Assignees

Labels

status: needs-triagePossible bug which hasn't been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions