Describe the Bug
If you add two 'blocks' fields to the same collection that reference the same blocks, only one of them will properly reference the interface name in the generated payload-types.ts.
For example, with this definition for Users:
import type { Block, CollectionConfig } from 'payload'
export const SampleBlock: Block = {
slug: 'sample-block',
interfaceName: 'SampleBlock',
fields: [
{
name: 'field',
type: 'text',
},
],
}
export const Users: CollectionConfig = {
slug: 'users',
admin: {
useAsTitle: 'email',
},
auth: true,
fields: [
// Email added by default
// Add more fields as needed
{
name: 'field1',
type: 'blocks',
blocks: [SampleBlock],
},
{
name: 'field2',
type: 'blocks',
blocks: [SampleBlock],
},
],
}
... the generated type is:
export interface User {
id: number;
field1?:
| {
field?: string | null;
id?: string | null;
blockName?: string | null;
blockType: 'sample-block';
}[]
| null;
field2?: SampleBlock[] | null;
[snip]
... but it should be:
export interface User {
id: number;
field1?: SampleBlock[] | null;
field2?: SampleBlock[] | null;
[snip]
It looks to me that only the last field gets assigned the proper interface type?
Link to the code that reproduces this issue
https://github.com/galenwarren/payloadcms-bug-demo
Reproduction Steps
Run npm run generate:types and see what is generated for User.
Which area(s) are affected?
area: core
Environment Info
Binaries: Node: 24.6.0 npm: 11.5.1 Yarn: N/A pnpm: N/A Relevant Packages: payload: 3.79.0 next: 15.4.11 @payloadcms/db-sqlite: 3.79.0 @payloadcms/drizzle: 3.79.0 @payloadcms/graphql: 3.79.0 @payloadcms/next/utilities: 3.79.0 @payloadcms/richtext-lexical: 3.79.0 @payloadcms/translations: 3.79.0 @payloadcms/ui/shared: 3.79.0 react: 19.2.1 react-dom: 19.2.1 Operating System: Platform: linux Arch: x64 Version: #1 SMP PREEMPT_DYNAMIC PMX 6.17.4-2 (2025-12-19T07:49Z) Available memory (MB): 16384 Available CPU cores: 8
Describe the Bug
If you add two 'blocks' fields to the same collection that reference the same blocks, only one of them will properly reference the interface name in the generated payload-types.ts.
For example, with this definition for Users:
... the generated type is:
... but it should be:
It looks to me that only the last field gets assigned the proper interface type?
Link to the code that reproduces this issue
https://github.com/galenwarren/payloadcms-bug-demo
Reproduction Steps
Run
npm run generate:typesand see what is generated for User.Which area(s) are affected?
area: core
Environment Info