@@ -291,6 +291,21 @@ export type ${displayName}Update = Partial<${displayName}Input>;
291291 * Generate types index file
292292 */
293293 private generateTypesIndex ( ) : void {
294+ const collections = Array . from ( this . collections . values ( ) ) ;
295+
296+ // Generate collection exports
297+ const collectionExports = collections
298+ . map ( ( collection ) => `export * from './types/${ collection . slug } ';` )
299+ . join ( '\n' ) ;
300+
301+ // Generate re-export statements for commonly used types
302+ const reExports = collections
303+ . map (
304+ ( collection ) =>
305+ `export type { ${ collection . displayName } } from './types/${ collection . slug } ';`
306+ )
307+ . join ( '\n' ) ;
308+
294309 const indexContent = `/**
295310 * Types index - exports all collection types
296311 * Generated from Payload CMS collections
@@ -302,16 +317,14 @@ export type ${displayName}Update = Partial<${displayName}Input>;
302317export * from './types/base';
303318
304319// Collection types
305- export * from './types/media';
306- export * from './types/pages';
320+ ${ collectionExports }
321+
322+ // Global types
307323export * from './types/site-settings';
308- export * from './types/users';
309324
310325// Re-export commonly used types for convenience
311- export type { Media } from './types/media';
312- export type { Pages } from './types/pages';
326+ ${ reExports }
313327export type { SiteSettings } from './types/site-settings';
314- export type { Email } from './types/users';
315328` ;
316329
317330 const typesIndexPath = path . join ( this . config . outputPath , 'types.ts' ) ;
0 commit comments