payloadcms / payloadcms/payload
FIELD-TYPE-GUARDS.md imports field type guards from wrong package in code examples
@zubricks is already working on this.
Since Jun 6, 2026.
- Dominant language
- TypeScript
- Stars
- 44.8k
- Forks
- 4.2k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 53
Description
Documentation Issue
Summary:
The reference documentation for field type guards in tools/claude-plugin/skills/payload/reference/FIELD-TYPE-GUARDS.md currently imports guard functions like fieldAffectsData and fieldHasSubFields from payload, but these helpers are actually exported from payload/shared, which matches current usage throughout the repository. This can cause confusion for users copying the examples and leads to import errors or mismatches with the actual codebase.
Additional Details
- The location of the affected documentation is:
tools/claude-plugin/skills/payload/reference/FIELD-TYPE-GUARDS.md- (Potentially also:
tools/claude-plugin/skills/payload/reference/FIELDS.md)
- Current examples use imports like:
import type { Field } from 'payload' import { fieldHasSubFields } from 'payload' import { fieldAffectsData, fieldHasSubFields, fieldIsArrayType } from 'payload' - Actual working usage should be:
import type { Field } from 'payload' import { fieldHasSubFields } from 'payload/shared' import { fieldAffectsData, fieldHasSubFields, fieldIsArrayType } from 'payload/shared' - This matches both the export source (
packages/payload/src/exports/shared.ts) and existing usage in core packages (graphql, drizzle, UI, plugin-import-export, etc).
Suggested fix:
- Update all code samples in
FIELD-TYPE-GUARDS.md(and optionallyFIELDS.md) to usepayload/sharedfor field guard helpers while keeping types imported frompayload. - This will help keep docs in sync with current code and prevent copy-paste confusion for users.
Reference conversation:
- See https://github.com/payloadcms/payload/blob/386805c34433dada690135010e62440b1f2b1006/tools/claude-plugin/skills/payload/reference/FIELD-TYPE-GUARDS.md for the current file.
- Discrepancy identified in user and repo usage, confirmed by semantic and code search.
Copilot conversation context: We found no open issues filing this discrepancy, but several export errors have affected users due to import/export mismatches (payload/shared, etc). This update would close a gap in the docs discovered during a code review.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.