Skip to content

refactor(pages): migrate pages collection config to built-in type-safe custom field#43

Draft
jhb-dev wants to merge 1 commit intomainfrom
refactor/pages/pages-collection-config-built-in-type-safe-custom-field
Draft

refactor(pages): migrate pages collection config to built-in type-safe custom field#43
jhb-dev wants to merge 1 commit intomainfrom
refactor/pages/pages-collection-config-built-in-type-safe-custom-field

Conversation

@jhb-dev
Copy link
Copy Markdown
Contributor

@jhb-dev jhb-dev commented Nov 28, 2025

⚠️ This PR requires Payload ^3.65.0 for type-safe custom field support. Will merge after allowing time for users to upgrade.

Summary

Refactors page collection configuration to use Payload's build-in type-safe custom field pattern via module augmentation, replacing the previous approach of using a custom PageCollectionConfig type for extending Payload's CollectionConfig type.

Breaking Changes

Before:

import { PageCollectionConfig } from '@jhb.software/payload-pages-plugin'

export const Pages: PageCollectionConfig = {
  slug: 'pages',
  page: {
    parent: { collection: 'pages', name: 'parent' },
    isRootCollection: true,
  }
 // ...
}

After:

import type { CollectionConfig } from 'payload'

export const Pages: CollectionConfig = {
  slug: 'pages',
  custom: {
    pagesPlugin: {
      page: {
        parent: { collection: 'pages', name: 'parent' },
        isRootCollection: true,
      },
    },
  },
  // ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant