Skip to content

Types for default richText validation function is not compatible with what validate provides #15068

@Arctomachine

Description

@Arctomachine

Describe the Bug

Validate of rich text field provides props that are not compatible by type with default richText validator function.
It is only type issue.

validate: (value, args) => {
	return richText(value, args)
}
Argument of type
ValidateOptions<any, any, object, any>
is not assignable to parameter of type
ValidateOptions<unknown, unknown, RichTextField, object>
. Property type is missing in type
BaseValidateOptions<any, any, any>
but required in type
{ admin?: ({ components?: ({ afterInput?: CustomComponent[] | undefined; beforeInput?: CustomComponent[] | undefined; Error?: CustomComponent | undefined; Label?: CustomComponent | undefined; } & { ...; }) | undefined; } & FieldAdmin) | undefined; editor?: RichTextAdapter<...> | ... 1 more ... | undefined; maxDepth?...
. (ts 2345)

Link to the code that reproduces this issue

Provided above

Reproduction Steps

  1. Create rich text field
  2. Add validation
  3. Inside there use default richText validator
  4. Pass props

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 23.7.0
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  payload: 3.69.0
  next: 15.4.10
  @payloadcms/db-mongodb: 3.69.0
  @payloadcms/graphql: 3.69.0
  @payloadcms/next/utilities: 3.69.0
  @payloadcms/richtext-lexical: 3.69.0
  @payloadcms/translations: 3.69.0
  @payloadcms/ui/shared: 3.69.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
  Available memory (MB): 32720
  Available CPU cores: 12

Metadata

Metadata

Assignees

No one assigned

    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