fix!: properly names BlocksField and related types (#8174)

The `BlockField` type is not representative of the underlying "blocks"
field type, which is plural, i.e. `BlocksField`. This is a semantic
change that will better align the type with the field.

## Breaking Changes

Types related to the `blocks` field have change names. If you were using
the `BlockField` or related types in your own applications, simply
change the import name to be plural and instead of singular.

Old (singular):

```ts
import type {
  BlockField,
  BlockFieldClient,
  BlockFieldValidation,
  BlockFieldDescriptionClientComponent,
  BlockFieldDescriptionServerComponent,
  BlockFieldErrorClientComponent,
  BlocksFieldErrorServerComponent,
  BlockFieldLabelClientComponent,
  BlockFieldLabelServerComponent,
} from 'payload'
```

New (plural):

```ts
import type {
  BlocksField,
  BlocksFieldClient,
  BlocksFieldValidation,
  BlocksFieldDescriptionClientComponent,
  BlocksFieldDescriptionServerComponent,
  BlocksFieldErrorClientComponent,
  BlocksFieldErrorServerComponent,
  BlocksFieldLabelClientComponent,
  BlocksFieldLabelServerComponent,
} from 'payload'
```
This commit is contained in:
Jacob Fletcher
2024-09-11 12:05:03 -04:00
committed by GitHub
parent 043bf95a70
commit 465e47a219
19 changed files with 80 additions and 73 deletions

View File

@@ -2,7 +2,7 @@ import type { IndexOptions, Schema, SchemaOptions, SchemaTypeOptions } from 'mon
import type {
ArrayField,
Block,
BlockField,
BlocksField,
CheckboxField,
CodeField,
CollapsibleField,
@@ -176,7 +176,7 @@ const fieldToSchemaMap: Record<string, FieldSchemaGenerator> = {
})
},
blocks: (
field: BlockField,
field: BlocksField,
schema: Schema,
config: SanitizedConfig,
buildSchemaOptions: BuildSchemaOptions,

View File

@@ -1,7 +1,7 @@
import type { IndexDefinition, IndexOptions, Model, PaginateModel, SchemaOptions } from 'mongoose'
import type {
ArrayField,
BlockField,
BlocksField,
CheckboxField,
CodeField,
CollapsibleField,
@@ -76,7 +76,7 @@ export type FieldGeneratorFunction<TSchema, TField extends Field> = (
*/
export type FieldToSchemaMap<TSchema> = {
array: FieldGeneratorFunction<TSchema, ArrayField>
blocks: FieldGeneratorFunction<TSchema, BlockField>
blocks: FieldGeneratorFunction<TSchema, BlocksField>
checkbox: FieldGeneratorFunction<TSchema, CheckboxField>
code: FieldGeneratorFunction<TSchema, CodeField>
collapsible: FieldGeneratorFunction<TSchema, CollapsibleField>