payload icon indicating copy to clipboard operation
payload copied to clipboard

Type error for hidden field in ClientField for RenderFields

Open 58bits opened this issue 1 year ago • 0 comments

Link to reproduction

No response

Payload Version

3.0.0-beta.88

Node Version

20

Next.js Version

15.0.0-canary.104

Describe the Bug

Prior to beta.79, we could create a hidden MappedField in array of MappedField[] to be supplied to the fieldMap prop of the RenderFields component. For example....

{
  name: 'foo',
  cellComponentProps: { name: 'foo', schemaPath: 'foo' },
  fieldComponentProps: { name: 'foo' },
  fieldIsPresentational: false,
  isFieldAffectingData: true,
  localized: false,
  isHidden: true,
  type: 'text'
},

.. would create a hidden text field (input type="hidden")

After migrating to the new ClientField[] and RenderFields prop fields - setting admin props for hidden as below (and other props?) results in an eslint/type error.

{
  name: 'foo',
  localized: false,
  type: 'text',
  admin: {
    hidden: true
  }
},

image

This can be solved by placing // @ts-expect-error: type error above the field definition, and admin.hidden will work as expected, creating an input type="hidden" text field.

Apologies in advance if this is our mistake, or an incorrect eslint configuration, although we have a hunch there is a type issue for ClientField admin props.

Hope this helps

Reproduction Steps

As above.

Adapters and Plugins

No response

58bits avatar Aug 21 '24 17:08 58bits