Payload is the open-source, fullstack Next.js framework, giving you instant backend superpowers. Get a full TypeScript backend and admin panel instantly. Use Payload as a headless CMS or for building powerful applications.
fix: add distinct validate to richtext field type definition (#15069)
### What?
This PR adds the `RichTextFieldValidation` type to the `validate`
property of the `RichTextField`.
### Why?
Previously, adding the default `richText` validate function to a typical
`type: 'richText'` field would result in a TS error due to mismatching
types, specifically on the `options` argument. With these changes, you
can now simply thread the default `richText` validation through to the
`validate` property as expected with no unnecessary type manipulation.
Previously, this would result in a TS error:
```ts
import type { CollectionConfig } from 'payload'
import { richText } from 'payload/shared'
export const PostsCollection: CollectionConfig = {
slug: 'posts',
// ...
fields: [
// ...
{
name: 'content',
type: 'richText',
validate: richText, // Type error here
},
],
}
```
With the changes introduced here, the TS error is resolved.
### How?
By threading the existing `RichTextFieldValidation` type to the
`validate` property of the `RichTextField`.
Fixes #15068 S
Said Akhrarov committed
d68e75ada700d88d9ecba8236d49e8c608bbae4f
Parent: cdabf79
Committed by GitHub <noreply@github.com>
on 1/13/2026, 3:57:02 AM